From 55a39b80331b40f6a15c58cc22668dab19545338 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Fri, 18 Oct 2002 20:43:56 +0000 Subject: [PATCH] avoid creating negative values out of unsigned values using MAX, check to Fri Oct 18 13:41:30 2002 Manish Singh * glib/giochannel.c (g_io_channel_read_line_backend): avoid creating negative values out of unsigned values using MAX, check to see if the result would be positive before doing the calculation. --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-12 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ glib/giochannel.c | 5 ++++- 8 files changed, 53 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 04c64f71a..9756bfef8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Oct 18 13:41:30 2002 Manish Singh + + * glib/giochannel.c (g_io_channel_read_line_backend): avoid + creating negative values out of unsigned values using MAX, + check to see if the result would be positive before doing + the calculation. + Tue Oct 15 15:28:47 2002 Manish Singh * tests/iochannel-test.c: use gsize instead of int where appropriate diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 04c64f71a..9756bfef8 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Fri Oct 18 13:41:30 2002 Manish Singh + + * glib/giochannel.c (g_io_channel_read_line_backend): avoid + creating negative values out of unsigned values using MAX, + check to see if the result would be positive before doing + the calculation. + Tue Oct 15 15:28:47 2002 Manish Singh * tests/iochannel-test.c: use gsize instead of int where appropriate diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 04c64f71a..9756bfef8 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +Fri Oct 18 13:41:30 2002 Manish Singh + + * glib/giochannel.c (g_io_channel_read_line_backend): avoid + creating negative values out of unsigned values using MAX, + check to see if the result would be positive before doing + the calculation. + Tue Oct 15 15:28:47 2002 Manish Singh * tests/iochannel-test.c: use gsize instead of int where appropriate diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 04c64f71a..9756bfef8 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Fri Oct 18 13:41:30 2002 Manish Singh + + * glib/giochannel.c (g_io_channel_read_line_backend): avoid + creating negative values out of unsigned values using MAX, + check to see if the result would be positive before doing + the calculation. + Tue Oct 15 15:28:47 2002 Manish Singh * tests/iochannel-test.c: use gsize instead of int where appropriate diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 04c64f71a..9756bfef8 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Fri Oct 18 13:41:30 2002 Manish Singh + + * glib/giochannel.c (g_io_channel_read_line_backend): avoid + creating negative values out of unsigned values using MAX, + check to see if the result would be positive before doing + the calculation. + Tue Oct 15 15:28:47 2002 Manish Singh * tests/iochannel-test.c: use gsize instead of int where appropriate diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 04c64f71a..9756bfef8 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Fri Oct 18 13:41:30 2002 Manish Singh + + * glib/giochannel.c (g_io_channel_read_line_backend): avoid + creating negative values out of unsigned values using MAX, + check to see if the result would be positive before doing + the calculation. + Tue Oct 15 15:28:47 2002 Manish Singh * tests/iochannel-test.c: use gsize instead of int where appropriate diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 04c64f71a..9756bfef8 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Fri Oct 18 13:41:30 2002 Manish Singh + + * glib/giochannel.c (g_io_channel_read_line_backend): avoid + creating negative values out of unsigned values using MAX, + check to see if the result would be positive before doing + the calculation. + Tue Oct 15 15:28:47 2002 Manish Singh * tests/iochannel-test.c: use gsize instead of int where appropriate diff --git a/glib/giochannel.c b/glib/giochannel.c index 5c198764c..b463a24b9 100644 --- a/glib/giochannel.c +++ b/glib/giochannel.c @@ -1600,7 +1600,10 @@ read_again: break; } - checked_to = MAX (use_buf->len - (line_term_len - 1), 0); + if (use_buf->len > line_term_len - 1) + checked_to = use_buf->len - (line_term_len - 1); + else + checked_to = 0; } done: