blob: 738ea52bf7fb5502d886bb7022aea38b88c84ccc [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001--- a/extract.c
2+++ b/extract.c
3@@ -1257,8 +1257,17 @@ static int extract_or_test_entrylist(__G
4 if (G.lrec.compression_method == STORED) {
5 zusz_t csiz_decrypted = G.lrec.csize;
6
7- if (G.pInfo->encrypted)
8+ if (G.pInfo->encrypted) {
9+ if (csiz_decrypted <= 12) {
10+ /* handle the error now to prevent unsigned overflow */
11+ Info(slide, 0x401, ((char *)slide,
12+ LoadFarStringSmall(ErrUnzipNoFile),
13+ LoadFarString(InvalidComprData),
14+ LoadFarStringSmall2(Inflate)));
15+ return PK_ERR;
16+ }
17 csiz_decrypted -= 12;
18+ }
19 if (G.lrec.ucsize != csiz_decrypted) {
20 Info(slide, 0x401, ((char *)slide,
21 LoadFarStringSmall2(WrnStorUCSizCSizDiff),