tsolomko / SWCompression

A Swift framework for working with compression, archives and containers.
MIT License
233 stars 39 forks source link

[CRASH] MsbBitReader.bit() #30

Closed Lakr233 closed 2 years ago

Lakr233 commented 2 years ago
Hardware Model:     iPhone13,3
Process:            chromatic
Identifier:         wiki.qaq.chromatic.release
Version:            1641794667
Role:               Foreground
OS Version:         iOS 14.4
Exception Type:     EXC_BREAKPOINT 
Exception Subtype:  KERN_INVALID_ADDRESS

0  chromatic               MsbBitReader.bit() (chromatic)
1  chromatic               DecodingTree.findNextSymbol() (chromatic)
2  chromatic               specialized static BZip2.decode(_:_:) (chromatic)
3  chromatic               specialized static BZip2.decompress(_:) (chromatic)
4  chromatic               static BZip2.decompress(data:) (chromatic)
5  chromatic               RepositoryCenter.downloadUpdatePackage(withBaseUrl:suffix:) (chromatic)

Have checked my build and should not be crashing on prediction. Having no idea about what cased the crash. Affecting 1 user over 10 times in a short time.

tsolomko commented 2 years ago

If you could provide a bz2 file that causes this crash, that would be very helpful. Otherwise, it is very hard for me to diagnose this issue.

Lakr233 commented 2 years ago

I haven't include user's data in my crash report and it's a little bit hard to reach out the user. But will get back to you if anything available then.

tsolomko commented 2 years ago

If I had to guess, I would say that this may be caused by trying to process incomplete BZip2 archive. Could such situation occur in your program (I mean, is it possible that RepositoryCenter.downloadUpdatePackage(withBaseUrl:suffix:) passes incomplete bz2 into BZip2.decompress)?

However, to confirm that there aren't more nefarious bugs in BZip2.decompress, I would still have to examine the problematic file.

tsolomko commented 2 years ago

4.8.0 has been released, which includes a fix for a problem that I suspected in this thread:

If I had to guess, I would say that this may be caused by trying to process incomplete BZip2 archive. Could such situation occur in your program (I mean, is it possible that RepositoryCenter.downloadUpdatePackage(withBaseUrl:suffix:) passes incomplete bz2 into BZip2.decompress)?

Let me know, if this didn't help.