From: Manish Singh Date: Fri, 18 Oct 2002 20:43:56 +0000 (+0000) Subject: avoid creating negative values out of unsigned values using MAX, check to X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=55a39b80331b40f6a15c58cc22668dab19545338;p=dana%2Fcg-glib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 04c64f71..9756bfef 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 04c64f71..9756bfef 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 04c64f71..9756bfef 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 04c64f71..9756bfef 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 04c64f71..9756bfef 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 04c64f71..9756bfef 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 04c64f71..9756bfef 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 5c198764..b463a24b 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: