]> granicus.if.org Git - file/commitdiff
PR/193: avoid zerodivide
authorChristos Zoulas <christos@zoulas.com>
Sun, 28 Aug 2011 08:38:48 +0000 (08:38 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sun, 28 Aug 2011 08:38:48 +0000 (08:38 +0000)
src/cdf.c

index d49ea9aeb80a4adba27db4da7afbd04b7245a78b..9d73a598f0fe0c1895f64dbd46bb2d131bc24c0b 100644 (file)
--- a/src/cdf.c
+++ b/src/cdf.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.44 2011/08/26 13:38:28 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.45 2011/08/28 08:38:48 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -376,7 +376,8 @@ cdf_read_sat(const cdf_info_t *info, cdf_header_t *h, cdf_sat_t *sat)
                        break;
 
 #define CDF_SEC_LIMIT (UINT32_MAX / (4 * ss))
-       if (h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec ||
+       if ((nsatpersec > 0 &&
+           h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec) ||
            i > CDF_SEC_LIMIT) {
                DPRINTF(("Number of sectors in master SAT too big %u %"
                    SIZE_T_FORMAT "u\n", h->h_num_sectors_in_master_sat, i));