aboutsummaryrefslogtreecommitdiff
path: root/jquant2.c
diff options
context:
space:
mode:
authordcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db>2014-02-06 19:30:32 +0000
committerdcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db>2014-02-06 19:30:32 +0000
commit28392816c15b357c923281e4d0ddbca4d97f578b (patch)
tree7c67c56b0fd61b8942f43af85db1309bc16a8065 /jquant2.c
parentcabd22366aca7d00189ebf6ea0f88b48a066638b (diff)
Fix several potential overflow issues identified by the community.
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1112 632fc199-4ca6-4c93-a231-07263d6284db
Diffstat (limited to 'jquant2.c')
-rw-r--r--jquant2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/jquant2.c b/jquant2.c
index 9b060e5..d994470 100644
--- a/jquant2.c
+++ b/jquant2.c
@@ -513,6 +513,8 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
}
}
+ if (total == 0)
+ return;
cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total);
cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total);
cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total);