You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.
I created simple rar and zip files with WinRar to use for testing Junrar. They contain a simple text file. For the encrypted archives, the password is just "encrypted". See attachments,
For unencrypted.rar, I expected extraction to work. For everything else, I expected RarException. For the zip files, I get unexpected NullPointerException instead. One line of code is sufficient to reproduce the NullPointerException in Junrar.
Archive arc = new Archive(new File("C:/encrypted.zip"));
Root cause is Junrar's Archive.java line 245. The return value of BaseBlock.getHeaderType() is null, and passing a null value to a switch() statement triggers a NullPointerException.
To fix, please add a null check for BaseBlock.getHeaderType() and throw RarException. This simple patch should help improve the graceful error handling of Junrar.
Hello,
I created simple rar and zip files with WinRar to use for testing Junrar. They contain a simple text file. For the encrypted archives, the password is just "encrypted". See attachments,
For unencrypted.rar, I expected extraction to work. For everything else, I expected RarException. For the zip files, I get unexpected NullPointerException instead. One line of code is sufficient to reproduce the NullPointerException in Junrar.
Root cause is Junrar's Archive.java line 245. The return value of BaseBlock.getHeaderType() is null, and passing a null value to a switch() statement triggers a NullPointerException.
241 BaseBlock block = new BaseBlock(baseBlockBuffer);
242
243 block.setPositionInFile(position);
244
245 switch (block.getHeaderType()) {
To fix, please add a null check for BaseBlock.getHeaderType() and throw RarException. This simple patch should help improve the graceful error handling of Junrar.
Thank you,
Justin
encrypted.zip
unencrypted.zip
The text was updated successfully, but these errors were encountered: