From: Taylor R Campbell Date: Sat, 10 Nov 2018 18:01:00 +0000 (+0000) Subject: Check for overflow in int, not size_t. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~110 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=467bef5f6ad157d28f49a21e7e1b0e94c15ba92c;p=mit-scheme.git Check for overflow in int, not size_t. --- diff --git a/src/microcode/findprim.c b/src/microcode/findprim.c index f6a117725..f85f5e232 100644 --- a/src/microcode/findprim.c +++ b/src/microcode/findprim.c @@ -633,7 +633,7 @@ initialize_token_buffer (void) void grow_token_buffer (void) { - if (token_buffer_length >= (SIZE_MAX / 2)) + if (token_buffer_length >= (INT_MAX / 2)) { fprintf (stderr, "token buffer overflow\n"); exit (1); @@ -817,7 +817,7 @@ void grow_data_buffer (void) { char * old_data_buffer = ((char *) data_buffer); - if (buffer_length >= (SIZE_MAX / (2 * (sizeof (struct descriptor))))) + if (buffer_length >= (INT_MAX / (2 * (sizeof (struct descriptor))))) { fprintf (stderr, "data buffer overflow\n"); exit (1); @@ -837,7 +837,7 @@ grow_data_buffer (void) scan += 1; } } - if (buffer_length >= (SIZE_MAX / (sizeof (struct descriptor *)))) + if (buffer_length >= (INT_MAX / (sizeof (struct descriptor *)))) { fprintf (stderr, "result buffer overflow\n"); exit (1);