From: Christos Zoulas Date: Sun, 28 Aug 2011 08:38:48 +0000 (+0000) Subject: PR/193: avoid zerodivide X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0e42a9f43f68e8b85e4c84cc2f7d2454f5045808;p=file PR/193: avoid zerodivide --- diff --git a/src/cdf.c b/src/cdf.c index d49ea9ae..9d73a598 100644 --- 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 @@ -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));