summaryrefslogtreecommitdiffstats
path: root/tests/imgPPM.test
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-11-26 20:53:57 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-11-26 20:53:57 (GMT)
commit04d59cbc4af657da97a836a24ed6f952bb1a3633 (patch)
tree1f3a435ace170a7ccfe7ee18e33f9f2fab8f2dc3 /tests/imgPPM.test
parent86cb489f9d555eb126bc7af0aed33123a9c1742c (diff)
downloadtk-04d59cbc4af657da97a836a24ed6f952bb1a3633.zip
tk-04d59cbc4af657da97a836a24ed6f952bb1a3633.tar.gz
tk-04d59cbc4af657da97a836a24ed6f952bb1a3633.tar.bz2
Backport from HEAD of [Bug #1822391]:
* 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/imgPPM.test')
-rw-r--r--tests/imgPPM.test15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/imgPPM.test b/tests/imgPPM.test
index 867f54a..de43786 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.5 2002/07/13 21:52:34 dgp Exp $
+# RCS: @(#) $Id: imgPPM.test,v 1.5.2.1 2007/11/26 20:53:57 kennykb Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -150,6 +150,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}
+
removeFile test.ppm
removeFile test2.ppm
eval image delete [image names]