Fix possible divide by zero error
authorJohn Darrington <john@cellform.com>
Sun, 4 Jun 2023 16:10:24 +0000 (18:10 +0200)
committerJohn Darrington <john@cellform.com>
Sun, 4 Jun 2023 16:33:30 +0000 (18:33 +0200)
utilities/pspp-dump-sav.c

index cb8d804134e4099165cf9c5258fdff5197957590..03f3a7c0dc684981101fada8d185d0794c3503c0 100644 (file)
@@ -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;