Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when archive contains a binary file #4

Open
Zer0-Tolerance opened this issue Oct 30, 2022 · 1 comment
Open

Crash when archive contains a binary file #4

Zer0-Tolerance opened this issue Oct 30, 2022 · 1 comment

Comments

@Zer0-Tolerance
Copy link

The library is behaving correctly when you try to read an archive containing any binary file like an image, see the error below:

rak -z live /tmp/test.7z                               09:56:34
A worker in a parallel iteration (hyper or race) initiated here:
  in sub show-results at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/1636BBF2572059F76159DF50C03D5DD52979E294 (App::Rak) line 806
  in sub rak-results at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/1636BBF2572059F76159DF50C03D5DD52979E294 (App::Rak) line 677
  in sub action-per-line at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/1636BBF2572059F76159DF50C03D5DD52979E294 (App::Rak) line 2891
  in sub main at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/1636BBF2572059F76159DF50C03D5DD52979E294 (App::Rak) line 423
  in block <unit> at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/resources/A0BA54D3D8B6443A1DA0C68A01CA42A3FC242435 line 3
  in sub MAIN at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/bin/rak line 3
  in block <unit> at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/bin/rak line 1

Died at:
    Malformed UTF-8 near bytes 8a 53 98
      in sub show-results at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/1636BBF2572059F76159DF50C03D5DD52979E294 (App::Rak) line 806
      in sub rak-results at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/1636BBF2572059F76159DF50C03D5DD52979E294 (App::Rak) line 677
      in sub action-per-line at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/1636BBF2572059F76159DF50C03D5DD52979E294 (App::Rak) line 2891
      in sub main at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/1636BBF2572059F76159DF50C03D5DD52979E294 (App::Rak) line 423
      in block <unit> at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/resources/A0BA54D3D8B6443A1DA0C68A01CA42A3FC242435 line 3
      in sub MAIN at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/bin/rak line 3
      in block <unit> at /Users/phil/.rakubrew/versions/moar-2022.07/share/perl6/site/bin/rak line 1

-z means --auto-decompress in my config. The library is not testing the type of file but assume it is utf-8 encoded. Not sure how you can manage this as it would be good to be able to search in binary file as well with Rak.
Any idea ?

@Zer0-Tolerance
Copy link
Author

it seems to be related to IO::Path support of binary file:

[1] > my $f="/tmp/test.7z".IO;
"/tmp/test.7z".IO
[2] > my $proc := run <7z e -so>, $f, :out;
(my \Proc_3193317352336 = Proc.new(in => IO::Pipe, out => IO::Pipe.new(proc => Proc_3193317352336, path => IO::Path, chomp => Bool::True, nl-in => "\n", nl-out => "\n", encoding => "utf8"), err => IO::Pipe, exitcode => Nil, signal => Any, pid => 94418, command => ("7z", "e", "-so", IO::Path.new("/tmp/test.7z", :SPEC(IO::Spec::Unix), :CWD("/Users/phil/Dropbox/tools/DarkRecon/scan/lib/IO-Path-AutoDecompress")))))
[3] > $proc.out.lines()
Malformed UTF-8 near bytes 8a 53 98

[4] > $proc.out.lines(True,:latin1)
Malformed UTF-8 near bytes 8a 53 98

[5] > my $proc := run <7z e -so>, $f, :out;
(my \Proc_3193317352944 = Proc.new(in => IO::Pipe, out => IO::Pipe.new(proc => Proc_3193317352944, path => IO::Path, chomp => Bool::True, nl-in => "\n", nl-out => "\n", encoding => "utf8"), err => IO::Pipe, exitcode => Nil, signal => Any, pid => 94428, command => ("7z", "e", "-so", IO::Path.new("/tmp/test.7z", :SPEC(IO::Spec::Unix), :CWD("/Users/phil/Dropbox/tools/DarkRecon/scan/lib/IO-Path-AutoDecompress")))))
[6] > $proc.out.lines(True,:latin1)
(PK)
[7] > $proc.out.lines(True,:latin1).say
(ᦊS_rels/PK)
[7] > $proc.out.lines(True,:latin1).[5]
Malformed UTF-8 near bytes 8a 53 98
  in block <unit> at <unknown file> line 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant