summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-11-26 20:38:34 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-11-26 20:38:34 (GMT)
commit55f6adc5b76aed80e9078d161d890051fecbc651 (patch)
tree4b3c4719ed27a5a97869113ec8a9418f1c35be81 /tests
parent671bcba7bb5831707282a085723aaf9c2812fd9a (diff)
downloadtk-55f6adc5b76aed80e9078d161d890051fecbc651.zip
tk-55f6adc5b76aed80e9078d161d890051fecbc651.tar.gz
tk-55f6adc5b76aed80e9078d161d890051fecbc651.tar.bz2
* generic/tkImgPPM.c (StringReadPPM): Corrected a comparison
whose sense was reversed that resulted in reading beyond the end of the input buffer on malformed PPM data. [Bug #1822391] * tests/imgPPM.test (imgPPM-4.1): Added test case that exercises [Bug #1822391].
Diffstat (limited to 'tests')
-rw-r--r--tests/imgPPM.test15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/imgPPM.test b/tests/imgPPM.test
index 53aa4c7..53d03c3 100644
--- a/tests/imgPPM.test
+++ b/tests/imgPPM.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: imgPPM.test,v 1.8 2004/12/08 03:03:06 dgp Exp $
+# RCS: @(#) $Id: imgPPM.test,v 1.9 2007/11/26 20:38:35 kennykb Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -146,6 +146,19 @@ test imgPPM-3.13 {ReadPPMFileHeader procedure, file ends too soon} {
list [catch {image create photo p1 -file test.ppm} msg] $msg
} {1 {couldn't recognize data in image file "test.ppm"}}
+test imgPPM-4.1 {StringReadPPM procedure, data too short [Bug 1822391]} \
+ -setup {
+ image create photo I -width 1103 -height 997
+ } \
+ -cleanup {
+ image delete I
+ } \
+ -body {
+ I put "P5\n1103 997\n255\n"
+ } \
+ -returnCodes error \
+ -result {truncated PPM data}
+
eval image delete [image names]
# cleanup