From 4c420cfc0c8b98ec83ac96e46902749d47720223 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 4 Mar 2009 17:26:10 +0000 Subject: Fix bug 2662434 --- ChangeLog | 5 +++++ generic/tclZlib.c | 8 +++++--- tests/zlib.test | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3c7b09..9ebfbbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-03-04 Donal K. Fellows + + * generic/tclZlib.c (TclZlibCmd): Checksums are defined to be unsigned + 32-bit integers, use Tcl_WideInt to pass to scripts. [Bug 2662434] + 2009-02-27 Jan Nijtmans * generic/tcl.decls: [Bug 218977] Tcl_DbCkfree needs a return value diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 13d7e27..968c0ed 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclZlib.c,v 1.24 2009/02/16 22:56:14 nijtmans Exp $ + * RCS: @(#) $Id: tclZlib.c,v 1.25 2009/03/04 17:26:23 dkf Exp $ */ #include "tclInt.h" @@ -1692,7 +1692,8 @@ TclZlibCmd( start = Tcl_ZlibAdler32(0, NULL, 0); } data = Tcl_GetByteArrayFromObj(objv[2], &dlen); - Tcl_SetIntObj(obj, (int) Tcl_ZlibAdler32(start, data, dlen)); + Tcl_SetWideIntObj(obj, + (Tcl_WideInt) Tcl_ZlibAdler32(start, data, dlen)); return TCL_OK; case z_crc32: /* crc32 str ?startvalue? * -> checksum */ @@ -1708,7 +1709,8 @@ TclZlibCmd( start = Tcl_ZlibCRC32(0, NULL, 0); } data = Tcl_GetByteArrayFromObj(objv[2], &dlen); - Tcl_SetIntObj(obj, (int) Tcl_ZlibCRC32(start, data, dlen)); + Tcl_SetWideIntObj(obj, + (Tcl_WideInt) Tcl_ZlibCRC32(start, data, dlen)); return TCL_OK; case z_deflate: /* deflate data ?level? * -> rawCompressedData */ diff --git a/tests/zlib.test b/tests/zlib.test index dd0b1dc..41599a6 100644 --- a/tests/zlib.test +++ b/tests/zlib.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: zlib.test,v 1.6 2008/12/21 21:17:19 das Exp $ +# RCS: @(#) $Id: zlib.test,v 1.7 2009/03/04 17:26:24 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -62,6 +62,9 @@ test zlib-6.2 {zlib crc32} zlib { test zlib-6.3 {zlib crc32} -constraints zlib -returnCodes error -body { zlib crc32 abcdeabcdeabcdeabcdeabcdeabcde 42 x } -result {wrong # args: should be "zlib crc32 data ?startValue?"} +test zlib-6.4 {zlib crc32: bug 2662434} -constraints zlib -body { + zlib crc32 "dabale arroz a la zorra el abad" +} -result 3842832571 test zlib-7.0 {zlib stream} -constraints zlib -returnCodes error -setup { set s [zlib stream compress] -- cgit v0.12