hippie68 / gogcheck

Bash script that verifies your GOG offline installers' authenticity and checksums. Made to scan large collections.
46 stars 2 forks source link

gogcheck: line 305: 09: value too great for base (error token is "09") #2

Closed systwi-again closed 2 years ago

systwi-again commented 2 years ago

gogcheck works wonderfully for every GOG release I throw at it, however for some reason, the EVERSPACE 2 files are an outlier. See my terminal output below:

$ gogcheck -r --
[1] ./setup_everspacetm_2_0.8.25294_(64bit)_(54783).exe
Running signature check...
Current PE checksum   : 00137EC8
Calculated PE checksum: 00137EC8
Signature Index: 0  (Primary Signature)
Message digest algorithm  : SHA1
Current message digest    : 1F0C0350716EA35984438A8A2F52600A8D956277
Calculated message digest : 1F0C0350716EA35984438A8A2F52600A8D956277
Signer's certificate:
Signer #0:
Subject: /C=PL/ST=Mazowieckie/L=Warszawa/O=GOG Sp. z o.o./CN=GOG Sp. z o.o.
Issuer : /C=US/O=DigiCert, Inc./CN=DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1
Serial : 0B17A63F5D10CB7D3B78AF8F676C7667
Number of certificates: 4
Signer #0:
Subject: /C=US/O=DigiCert, Inc./CN=DigiCert Trusted G4 RSA4096 SHA256 TimeStamping CA
Issuer : /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Trusted Root G4
Serial : 073637B724547CD847ACFD28662A5E5B
Signer #1:
Subject: /C=US/O=DigiCert, Inc./CN=DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1
Issuer : /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Trusted Root G4
Serial : 08AD40B260D29C4C9F5ECDA9BD93AED9
Signer #2:
Subject: /C=US/O=DigiCert, Inc./CN=DigiCert Timestamp 2022 - 2
Issuer : /C=US/O=DigiCert, Inc./CN=DigiCert Trusted G4 RSA4096 SHA256 TimeStamping CA
Serial : 0A7A4A889EC99942900663384D86979D
Signer #3:
Subject: /C=PL/ST=Mazowieckie/L=Warszawa/O=GOG Sp. z o.o./CN=GOG Sp. z o.o.
Issuer : /C=US/O=DigiCert, Inc./CN=DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1
Serial : 0B17A63F5D10CB7D3B78AF8F676C7667
The signature is timestamped: Apr  2 01:53:37 2022 GMT
Hash Algorithm: sha256
Timestamp Verified by:
Issuer : /C=US/O=DigiCert, Inc./CN=DigiCert Trusted G4 RSA4096 SHA256 TimeStamping CA
Serial : 0A7A4A889EC99942900663384D86979D
Timestamp Server Signature verification: OK
Signature verification: OK
Number of verified signatures: 1
Running binary check...
/home/systwi/.local/bin/gogcheck: line 305: 09: value too great for base (error token is "09")
1 file checked, 0 errors

$ echo $?
0
$ ls -la
total 35272608
drwxr-xr-x 2 systwi systwi       4096 Apr 12 07:23  .
drwxr-xr-x 3 systwi systwi       4096 Apr 12 06:31  ..
-rw-r--r-- 1 systwi systwi 4293736958 Apr  2 14:58 'setup_everspacetm_2_0.8.25294_(64bit)_(54783)-1.bin'
-rw-r--r-- 1 systwi systwi 4294967294 Apr  2 14:58 'setup_everspacetm_2_0.8.25294_(64bit)_(54783)-2.bin'
-rw-r--r-- 1 systwi systwi 4294967294 Apr  2 14:58 'setup_everspacetm_2_0.8.25294_(64bit)_(54783)-3.bin'
-rw-r--r-- 1 systwi systwi 4294967294 Apr  2 14:58 'setup_everspacetm_2_0.8.25294_(64bit)_(54783)-4.bin'
-rw-r--r-- 1 systwi systwi 4294967294 Apr  2 14:58 'setup_everspacetm_2_0.8.25294_(64bit)_(54783)-5.bin'
-rw-r--r-- 1 systwi systwi 4294967294 Apr  2 14:58 'setup_everspacetm_2_0.8.25294_(64bit)_(54783)-6.bin'
-rw-r--r-- 1 systwi systwi 4294967294 Apr  2 14:58 'setup_everspacetm_2_0.8.25294_(64bit)_(54783)-7.bin'
-rw-r--r-- 1 systwi systwi 4294967294 Apr  2 14:58 'setup_everspacetm_2_0.8.25294_(64bit)_(54783)-8.bin'
-rw-r--r-- 1 systwi systwi 1759352026 Apr  2 14:58 'setup_everspacetm_2_0.8.25294_(64bit)_(54783)-9.bin'
-rw-r--r-- 1 systwi systwi    1239168 Apr  2 12:10 'setup_everspacetm_2_0.8.25294_(64bit)_(54783).exe'

Tested using Arch GNU/Linux.

hippie68 commented 2 years ago

Thanks for reporting. It seems the value is treated as octal, which means all games with more than 7 parts would be affected.

Please try this file to see if the bug is fixed. I cannot test it currently. gogcheck.zip

systwi-again commented 2 years ago

Thank you for the quick reply and hotfix. I tried out the copy you linked to and it seems to have worked perfectly!

What's strange is that my copy of Cyberpunk 2077 (setup_cyberpunk_2077_build_3906793change_4790877_(64bit)_(54418)) has 27 .bin files and one .exe, and it was processed just fine on the previous gogcheck (i.e. the version before your hotfix from just now).

Thanks again. gogcheck is a really handy tool. :-)

hippie68 commented 2 years ago

Yes, I believe the bug only happened when the number of .bin files was 8 or 9.

I'm glad you like it, thanks!