Artifacts Associated With Ticket 0061c7a476f14112
Ticket change [701f028ce7] (rid 200217) by chrstphrchvz on 2022-04-16 16:40:27:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
UBSan (<tt>-fsanitize=shift-base</tt>) error: <blockquote><pre> <span style="font-weight:bold">tcl/generic/tclZipfs.c:470:55: <span style="color:crimson">runtime error:</span> left shift of 252 by 24 places cannot be represented in type 'int'</span> </pre></blockquote> Avoid by casting to <tt>unsigned int</tt> before shifting: <blockquote><pre> --- generic/tclZipfs.c.orig +++ generic/tclZipfs.c @@ -467,7 +467,8 @@ ZipReadInt( Tcl_Panic("out of bounds read(4): start=%p, end=%p, ptr=%p", bufferStart, bufferEnd, ptr); } <span style="color:crimson">- return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);</span> <span style="color:green">+ return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | + ((unsigned int)ptr[3] << 24);</span> } static inline unsigned short </pre></blockquote> - foundin initialized to: "core-8-branch"
- is_private initialized to: "0"
- login: "chrstphrchvz"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "chrstphrchvz"
- subsystem initialized to: "37. File System"
- title initialized to: "signed integer overflow in ZipReadInt()"
- type initialized to: "Patch"
Ticket change [16845da8d4] (rid 200218) by chrstphrchvz on 2022-04-16 16:41:49:
- comment changed to:
UBSan (<tt>-fsanitize=shift-base</tt>) error: <blockquote><pre> <span style="font-weight:bold">tcl/generic/tclZipfs.c:470:55: <span style="color:crimson">runtime error:</span> left shift of 252 by 24 places cannot be represented in type 'int'</span> </pre></blockquote> Avoid by casting to <tt>unsigned int</tt> before shifting: <blockquote><pre> --- generic/tclZipfs.c.orig +++ generic/tclZipfs.c @@ -467,7 +467,8 @@ ZipReadInt( Tcl_Panic("out of bounds read(4): start=%p, end=%p, ptr=%p", bufferStart, bufferEnd, ptr); } <span style="color:crimson">- return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);</span> <span style="color:green">+ return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | + ((unsigned int)ptr[3] << 24);</span> } static inline unsigned short </pre></blockquote> - login: "chrstphrchvz"
- mimetype: "text/plain"
- comment changed to:
Ticket change [17db8ac299] (rid 200225) by jan.nijtmans on 2022-04-18 16:56:32:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2459688.20593668"
- closer changed to: "jan.nijtmans"
- icomment:
Fixed [22b545403f|here] Thanks for the report and the patch!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"