]> granicus.if.org Git - libjpeg-turbo/commitdiff
TJBench: Fix FPE when decompressing 0-width JPEG
authorDRC <information@libjpeg-turbo.org>
Wed, 23 Jan 2019 17:06:47 +0000 (11:06 -0600)
committerDRC <information@libjpeg-turbo.org>
Wed, 23 Jan 2019 17:06:47 +0000 (11:06 -0600)
Fixes #319

ChangeLog.md
tjbench.c

index 64f2d3033812a5b2c55a56de44dba088d31594a5..e2d267dffd12e8019b625961a5bd45f2e2a9b29d 100644 (file)
@@ -63,6 +63,10 @@ a specially-crafted malformed color-index (8-bit-per-sample) Targa file in
 which some of the samples (color indices) exceeded the bounds of the Targa
 file's color table.
 
+11. Fixed a floating-point exception that occurred when attempting to
+decompress a specially-crafted malformed JPEG image with a specified image
+width or height of 0 using the C version of TJBench.
+
 
 1.5.3
 =====
index 1cf1cb14ca9dc9017cb0d59302a4076928290a80..0187b751c083e27b11ccc6007b608683a240882d 100644 (file)
--- a/tjbench.c
+++ b/tjbench.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C)2009-2017 D. R. Commander.  All Rights Reserved.
+ * Copyright (C)2009-2017, 2019 D. R. Commander.  All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -523,6 +523,8 @@ int decompTest(char *filename)
                _throwtj("executing tjInitTransform()");
        if(tjDecompressHeader3(handle, srcbuf, srcsize, &w, &h, &subsamp, &cs)==-1)
                _throwtj("executing tjDecompressHeader3()");
+       if(w<1 || h<1)
+               _throw("reading JPEG header", "Invalid image dimensions");
        if(cs==TJCS_YCCK || cs==TJCS_CMYK)
        {
                pf=TJPF_CMYK;  ps=tjPixelSize[pf];