From: John Darrington Date: Sat, 1 Dec 2012 06:07:13 +0000 (+0100) Subject: data-out.c: Added assertion to avoid out of bounds memory access X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e394f90199ff33404224bb3acfbfec860827c155;p=pspp data-out.c: Added assertion to avoid out of bounds memory access This could (has!) happened if the locale is not correctly set --- diff --git a/src/data/data-out.c b/src/data/data-out.c index 10ca4ede77..94e72f668b 100644 --- a/src/data/data-out.c +++ b/src/data/data-out.c @@ -864,6 +864,7 @@ rounder_init (struct rounder *r, double number, int max_decimals) r->leading_zeros = strspn (r->string, "0."); r->leading_nines = strspn (r->string, "9."); r->integer_digits = strchr (r->string, '.') - r->string; + assert (r->integer_digits < 64); assert (r->integer_digits >= 0); r->negative = number < 0; }