From: John Darrington Date: Sun, 4 Jun 2023 16:10:24 +0000 (+0200) Subject: Fix possible divide by zero error X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c34122fab8b460f1bb63c82b430462089ef2da3d;p=pspp Fix possible divide by zero error --- diff --git a/utilities/pspp-dump-sav.c b/utilities/pspp-dump-sav.c index cb8d804134..03f3a7c0dc 100644 --- a/utilities/pspp-dump-sav.c +++ b/utilities/pspp-dump-sav.c @@ -1435,7 +1435,7 @@ open_text_record (struct sfm_reader *r, size_t size, size_t count) { struct text_record *text = xmalloc (sizeof *text); - if (size_overflow_p (xsum (1, xtimes (size, count)))) + if (size > 0 && size_overflow_p (xsum (1, xtimes (count, size)))) sys_error (r, "Extension record too large."); size_t n_bytes = size * count;