File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -65,13 +65,24 @@ proc uncompressGzip*(
6565 checksum = read32 (src, len - 8 )
6666 isize = read32 (src, len - 4 )
6767
68+ when sizeof (int ) == 4 :
69+ if isize > int .high:
70+ raise newException (ZippyError , " Uncompressed size exceeds max string length" )
71+
6872 if trustSize:
69- dst.setLen (isize + 16 ) # Leave some room to write past the end
73+ when sizeof (int ) == 4 :
74+ dst.setLen (isize)
75+ else :
76+ dst.setLen (isize + 16 ) # Leave some room to write past the end
7077
7178 inflate (dst, src, len, pos)
7279
7380 if checksum != crc32 (dst):
7481 raise newException (ZippyError , " Checksum verification failed" )
7582
76- if isize != (dst.len mod (1 shl 32 )).uint32 :
77- raise newException (ZippyError , " Size verification failed" )
83+ when sizeof (int ) == 4 :
84+ if isize != dst.len.uint32 :
85+ raise newException (ZippyError , " Size verification failed" )
86+ else :
87+ if isize != (dst.len mod (1 shl 32 )).uint32 :
88+ raise newException (ZippyError , " Size verification failed" )
You can’t perform that action at this time.
0 commit comments