diff options
author | Kevin B Kenny <kennykb@acm.org> | 2007-11-26 20:53:57 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2007-11-26 20:53:57 (GMT) |
commit | 31f32c65cb3884482314651d32161c78ea1efb9d (patch) | |
tree | 1f3a435ace170a7ccfe7ee18e33f9f2fab8f2dc3 /tests/imgPPM.test | |
parent | 26edad6b5596aa6f86419b7e11ee24d3233e29d9 (diff) | |
download | tk-31f32c65cb3884482314651d32161c78ea1efb9d.zip tk-31f32c65cb3884482314651d32161c78ea1efb9d.tar.gz tk-31f32c65cb3884482314651d32161c78ea1efb9d.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.test | 15 |
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] |