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

infinite loop on after "Unexpected output file size" #118

Open
corwinn opened this issue Oct 21, 2020 · 0 comments
Open

infinite loop on after "Unexpected output file size" #118

corwinn opened this issue Oct 21, 2020 · 0 comments
Labels
Milestone

Comments

@corwinn
Copy link

corwinn commented Oct 21, 2020

hi, while unpacking foo-gog.exe using "innoextract-1.9-windows.zip" I got
"Unexpected output file size" followed by an infinite loop (100% CPU usage ;
"procmon" shows no activity at all);

innoextract.exe -t shows the same warning, but there is no inf. loop afterwards.

command: innoextract.exe -m -g --language en-US foo-gog.exe

Unfortunately the issue ain't reproducible with "innoextract-1.9.tar.gz" built
by "clang"-10.0.1 on "linux" x86_64 - no infinite loop, but more messages:
"Warning: Unexpected output file size: "...
Warning: Could not read back "bar" to calculate output checksum for multi-part file".

"bar" exists and is completely readable. State (on "linux") on function entry:

  • stream_.eof() = 0
  • max = 2305843009213693951
  • diff = checksum_position_ = file size (18876436)
  • "seekg(diff" sets the read pointer to the last byte of the file
  • "diff -=" sets "diff" to 0 ; the 1st "while" does not execute
  • the 2nd "while" executes once, since the 1st "read" raises "eof"

Perhaps, you should try the above in your "windows" environment.

Given "http://www.cplusplus.com/reference/istream/istream/read/",
could you create a test "windows" build with this patch:

diff --git a/innoextract-1.9/src/cli/extract.cpp b/../innoextract-1.9/src/cli/extract.cpp
index 91c3152..82e04e3 100644
--- a/innoextract-1.9/src/cli/extract.cpp
+++ b/../innoextract-1.9/src/cli/extract.cpp
@@ -255,11 +255,16 @@ public:
                while(!stream_.eof()) {
                        char buffer[8192];
                        std::streamsize n = stream_.read(buffer, sizeof(buffer)).gcount();
+                       if ((n <= 0 || not stream_) && not stream_.eof()) {
+                               log_warning << "TODO: calculate_checksum(): handle !eof can't read"
+                                       << "at " << __FILE__ << ":" << __LINE__;
+                               goto _has_checksum__aint_a_state;
+                       }
                        checksum_.update(buffer, size_t(n));
                        checksum_position_ += boost::uint64_t(n);
                }

-               if(!has_checksum()) {
+               if(!has_checksum()) { _has_checksum__aint_a_state:
                        log_warning << "Could not read back " << path_ << " to calculate output checksum for multi-part file";
                        return false;
                }

Thanks.

@dscharrer dscharrer added the bug label Aug 26, 2023
@dscharrer dscharrer added this to the 1.10 milestone Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants