@@ -1081,3 +1081,38 @@ func TestFS(t *testing.T) {
1081
1081
t .Fatal (err )
1082
1082
}
1083
1083
}
1084
+
1085
+ func TestCVE202127919 (t * testing.T ) {
1086
+ // Archive containing only the file "../test.txt"
1087
+ data := []byte {
1088
+ 0x50 , 0x4b , 0x03 , 0x04 , 0x14 , 0x00 , 0x08 , 0x00 ,
1089
+ 0x08 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
1090
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
1091
+ 0x00 , 0x00 , 0x0b , 0x00 , 0x00 , 0x00 , 0x2e , 0x2e ,
1092
+ 0x2f , 0x74 , 0x65 , 0x73 , 0x74 , 0x2e , 0x74 , 0x78 ,
1093
+ 0x74 , 0x0a , 0xc9 , 0xc8 , 0x2c , 0x56 , 0xc8 , 0x2c ,
1094
+ 0x56 , 0x48 , 0x54 , 0x28 , 0x49 , 0x2d , 0x2e , 0x51 ,
1095
+ 0x28 , 0x49 , 0xad , 0x28 , 0x51 , 0x48 , 0xcb , 0xcc ,
1096
+ 0x49 , 0xd5 , 0xe3 , 0x02 , 0x04 , 0x00 , 0x00 , 0xff ,
1097
+ 0xff , 0x50 , 0x4b , 0x07 , 0x08 , 0xc0 , 0xd7 , 0xed ,
1098
+ 0xc3 , 0x20 , 0x00 , 0x00 , 0x00 , 0x1a , 0x00 , 0x00 ,
1099
+ 0x00 , 0x50 , 0x4b , 0x01 , 0x02 , 0x14 , 0x00 , 0x14 ,
1100
+ 0x00 , 0x08 , 0x00 , 0x08 , 0x00 , 0x00 , 0x00 , 0x00 ,
1101
+ 0x00 , 0xc0 , 0xd7 , 0xed , 0xc3 , 0x20 , 0x00 , 0x00 ,
1102
+ 0x00 , 0x1a , 0x00 , 0x00 , 0x00 , 0x0b , 0x00 , 0x00 ,
1103
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
1104
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x2e ,
1105
+ 0x2e , 0x2f , 0x74 , 0x65 , 0x73 , 0x74 , 0x2e , 0x74 ,
1106
+ 0x78 , 0x74 , 0x50 , 0x4b , 0x05 , 0x06 , 0x00 , 0x00 ,
1107
+ 0x00 , 0x00 , 0x01 , 0x00 , 0x01 , 0x00 , 0x39 , 0x00 ,
1108
+ 0x00 , 0x00 , 0x59 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
1109
+ }
1110
+ r , err := NewReader (bytes .NewReader ([]byte (data )), int64 (len (data )))
1111
+ if err != nil {
1112
+ t .Fatalf ("Error reading the archive: %v" , err )
1113
+ }
1114
+ _ , err = r .Open ("test.txt" )
1115
+ if err != nil {
1116
+ t .Errorf ("Error reading file: %v" , err )
1117
+ }
1118
+ }
0 commit comments