mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Hang while opening BZip2 #641
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fuzzah on GitHub (May 15, 2024).
In continuation of #841.
The following code results in an infinite loop in SharpCompress:
The stack trace (created with the
dotnet stacktool):This byte sequence written to a file gets detected as "bzip2 compressed data" by the
filetool, butbzip2fails to read it with the error message "bzip2: Compressed file ends unexpectedly".Found by Linux Verification Center (linuxtesting.org) with AFL++ and SharpFuzz.
Reporter: Valery Korolyov (v.korolyov@gardatech.ru)
Organization: Garda Technologies (info@gardatech.ru)
@Morilli commented on GitHub (May 30, 2024):
Stepping through, the code correctly identifies the EOF here:
6fc4b045fd/src/SharpCompress/Compressors/BZip2/CBZip2InputStream.cs (L394-L397)and then proceeds to... do nothing?
6fc4b045fd/src/SharpCompress/Compressors/BZip2/CBZip2InputStream.cs (L42-L52)Perhaps the fix is just to make this function actually throw an exception instead of silently passing?
@adamhathcock commented on GitHub (Jun 4, 2024):
Seems like I should have ported the exception.
@DineshSolanki commented on GitHub (Jul 30, 2024):
So as #850 is merged, this should be closed?
@adamhathcock commented on GitHub (Aug 2, 2024):
Thanks!