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)
commit602608b847ac2ae5787ca3719931642c1116ee3f (patch)
tree4b3c4719ed27a5a97869113ec8a9418f1c35be81 /tests
parente1dd30a8b122ebc2e151e3066e5687e42b20b17d (diff)
downloadtk-602608b847ac2ae5787ca3719931642c1116ee3f.zip
tk-602608b847ac2ae5787ca3719931642c1116ee3f.tar.gz
tk-602608b847ac2ae5787ca3719931642c1116ee3f.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