So how do I do this. I asked chatgpt and the chinese communist party and they are lying so hard and contradicting each other. Apparently there is some kind of secret "props" that I have to read. These "props" might be 5 bytes or 5+8 bytes, they might be at the beginning or at the end of the compressed data, I dont know. They also just might not be there, who knows. There is no "extra" data, even though deepseek likes to pretend there is. In the "general purpose bit flag" there is a flag that indicates "lzma eos", whatever that means. Whatever I do it just never works. Either LzmaDec_Allocate doesnt work or LzmaDec_DecodeToBuf returns SZ_ERROR_DATA. I just create any zip file with any small text file with lzma and 7-zip can uncompress it just fine, but deepseek likes to pretend the file is somehow corrupt, some cosmic ray hit my disk and this flipped a bit, my "decoding loop" is somehow wrong even though this thing was the one that wrote it, its lying through its teeth and just making things up. I compile with USE_THREADS_CreateThread and Z7_ST, in case that makes a difference, no idea why but this was just the quickest way to get the things to compile and I already lost my patience. I compile all files that were there except a few with "Mt" in their name that made my headache worse.
Here is some example of what i have:
case 14:{
uint8_t lzmaProps[5];
String readprops=FileRead(&zip->f,5);
memcpy(lzmaProps,readprops->data,5);
compressedsize-=5;//compressed size from local header
SRes ret2=0;
ISzAlloc g_Alloc={SzAlloc,SzFree};
CLzmaDec state={0};
LzmaDec_Construct(&state);
if((ret2=LzmaDec_Allocate(&state,lzmaProps,5,&g_Alloc))!=SZ_OK){
Log("LzmaDec_Allocate %d",(int)ret2);
break;
}
LzmaDec_Init(&state);
ELzmaStatus status;
String uncompressed=StringFrom(0,12345);
while(compressedsize>0){
SizeT inSize=(SizeT)Min(12345,compressedsize);
String inbuf=FileRead(&zip->f,(unsigned)inSize);
compressedsize-=inSize;
Byte src=inbuf->data;
SizeT srcLen=inbuf->size;
SizeT destLen=uncompressed.capacity;
Byte dest=uncompressed.data;
ret2=LzmaDec_DecodeToBuf(&state,dest,&destLen,src,&srcLen,
(compressedsize==0)?LZMA_FINISH_END:LZMA_FINISH_ANY,
&status);
Log("LzmaDec_DecodeToBuf %d",(int)ret2);//returns 1 (SZ_ERROR_DATA)
//if(ret2!=SZ_OK){Log("LzmaDec_DecodeToBuf %d",(int)ret2);break;}
FileWrite(&out,uncompressed.data,destLen);
c2=Crc32(c2,uncompressed.data,(unsigned)destLen);
if(status==LZMA_STATUS_FINISHED_WITH_MARK)break;
}
LzmaDec_Free(&state,&g_Alloc);
break;
}
Thats just an example and I tried so many different things. It just never works. Then chatgpt suggests the compressed data is corrupt and I should validate some nonsense or try with some "known valid data" well HOW MANY TIMES????? Perhaps i should try all differnent combinations of all possible 5-byte props and for each one try uncompressing it from every possible offset with every possible length???
Last edit: asdfasdfasdf 2025-05-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I figured it out already. By BRUTE FORCE. The compressed data starts with FOUR BYTES OF GARBAGE. Like I said you have to try every possible combination to actually figure this out. Whatever the hell these four bytes mean. So four bytes of GARBAGE, indeed five bytes of those stupid "props" and then off you go. MY GOD what an awful unholy MESS. FINALLY.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So how do I do this. I asked chatgpt and the chinese communist party and they are lying so hard and contradicting each other. Apparently there is some kind of secret "props" that I have to read. These "props" might be 5 bytes or 5+8 bytes, they might be at the beginning or at the end of the compressed data, I dont know. They also just might not be there, who knows. There is no "extra" data, even though deepseek likes to pretend there is. In the "general purpose bit flag" there is a flag that indicates "lzma eos", whatever that means. Whatever I do it just never works. Either LzmaDec_Allocate doesnt work or LzmaDec_DecodeToBuf returns SZ_ERROR_DATA. I just create any zip file with any small text file with lzma and 7-zip can uncompress it just fine, but deepseek likes to pretend the file is somehow corrupt, some cosmic ray hit my disk and this flipped a bit, my "decoding loop" is somehow wrong even though this thing was the one that wrote it, its lying through its teeth and just making things up. I compile with USE_THREADS_CreateThread and Z7_ST, in case that makes a difference, no idea why but this was just the quickest way to get the things to compile and I already lost my patience. I compile all files that were there except a few with "Mt" in their name that made my headache worse.
Here is some example of what i have:
case 14:{
uint8_t lzmaProps[5];
String readprops=FileRead(&zip->f,5);
memcpy(lzmaProps,readprops->data,5);
compressedsize-=5;//compressed size from local header
SRes ret2=0;
ISzAlloc g_Alloc={SzAlloc,SzFree};
CLzmaDec state={0};
LzmaDec_Construct(&state);
if((ret2=LzmaDec_Allocate(&state,lzmaProps,5,&g_Alloc))!=SZ_OK){
Log("LzmaDec_Allocate %d",(int)ret2);
break;
}
LzmaDec_Init(&state);
ELzmaStatus status;
String uncompressed=StringFrom(0,12345);
while(compressedsize>0){
SizeT inSize=(SizeT)Min(12345,compressedsize);
String inbuf=FileRead(&zip->f,(unsigned)inSize);
compressedsize-=inSize;
Byte src=inbuf->data;
SizeT srcLen=inbuf->size;
SizeT destLen=uncompressed.capacity;
Byte dest=uncompressed.data;
ret2=LzmaDec_DecodeToBuf(&state,dest,&destLen,src,&srcLen,
(compressedsize==0)?LZMA_FINISH_END:LZMA_FINISH_ANY,
&status);
Log("LzmaDec_DecodeToBuf %d",(int)ret2);//returns 1 (SZ_ERROR_DATA)
//if(ret2!=SZ_OK){Log("LzmaDec_DecodeToBuf %d",(int)ret2);break;}
FileWrite(&out,uncompressed.data,destLen);
c2=Crc32(c2,uncompressed.data,(unsigned)destLen);
if(status==LZMA_STATUS_FINISHED_WITH_MARK)break;
}
LzmaDec_Free(&state,&g_Alloc);
break;
}
Thats just an example and I tried so many different things. It just never works. Then chatgpt suggests the compressed data is corrupt and I should validate some nonsense or try with some "known valid data" well HOW MANY TIMES????? Perhaps i should try all differnent combinations of all possible 5-byte props and for each one try uncompressing it from every possible offset with every possible length???
Last edit: asdfasdfasdf 2025-05-16
You could alt least format code as a code - like this:
Either using buttons in editor or ``` some code ``` in text.
SourceForge uses markdown and that's how you denote code.
I figured it out already. By BRUTE FORCE. The compressed data starts with FOUR BYTES OF GARBAGE. Like I said you have to try every possible combination to actually figure this out. Whatever the hell these four bytes mean. So four bytes of GARBAGE, indeed five bytes of those stupid "props" and then off you go. MY GOD what an awful unholy MESS. FINALLY.