upx / upx

UPX - the Ultimate Packer for eXecutables
https://upx.github.io
Other
14.62k stars 1.38k forks source link

CantPackException: bad DT_STRSZ 0x245c [C#] #858

Open misiek08 opened 2 weeks ago

misiek08 commented 2 weeks ago

What's the problem (or question)?

I'm getting error instead of compressed binary.

                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2024
UPX 4.2.4       Markus Oberhumer, Laszlo Molnar & John Reiser    May 9th 2024

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
upx: StaticFileServer: CantPackException: bad DT_STRSZ 0x245c

Packed 0 files.

What should have happened?

I should get compressed file, with Packed 1 file. info, example:

                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2024
UPX 4.2.4       Markus Oberhumer, Laszlo Molnar & John Reiser    May 9th 2024

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
   6778395 ->   3859192   56.93%   linux/amd64   controller

Packed 1 file.

Do you have an idea for a solution?

Didn't investigate. It worked great for Golang binary, but didn't work for C#/.NET8.0 PublishSingleFile=true.

How can we reproduce the issue?

  1. Prepare simplest .NET 8.0 C# sample program. I have simple static file server.
  2. dotnet publish -p:PublishSingleFile=true
  3. upx -9 <binary>
  4. Get error

Please tell us details about your environment.

jreiser commented 2 weeks ago

Please upload ("Paste, drop, or click to add files"), or give a downloadable URL, of an actual executable binary file that UPX declines to compress. Supplying an actual file is so much simpler and more reliable than any recipe to reproduce. GitHub accepts .zip, .gz, or .tgz files, so apply zip, gzip, or tar -cz before uploading.