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

APPCRASH: Segmentation Fault #2

Open
galib45 opened this issue Aug 10, 2020 · 15 comments
Open

APPCRASH: Segmentation Fault #2

galib45 opened this issue Aug 10, 2020 · 15 comments

Comments

@galib45
Copy link

galib45 commented Aug 10, 2020

I was trying to compress a win32 application with crinkler. I ran the following commands -
cl /c /O1 /GS- /Oi- /Gs9999 main.c
crinkler /TINYHEADER /SUBSYSTEM:WINDOWS main.obj kernel32.lib user32.lib gdi32.lib

It generates out.exe. But when I run the executable, it crashes with exception code c0000005. I ran the same executable in git bash where it showed segmentation fault. I googled the problem and found that it was trying to access some inaccessible memory region.

The program runs just fine when linked by link.exe

@askeksa
Copy link
Collaborator

askeksa commented Aug 12, 2020

Thanks for the report. If you send us your source code (or just the main.obj file that you give to Crinkler), we will have a look to see if we can identify the issue.

@galib45
Copy link
Author

galib45 commented Aug 12, 2020

Multiple attempts to mail you the source and object files failed. As a workaround I have uploaded the files to Google Drive and sharing the link.

This is the link - https://drive.google.com/file/d/1l97kDA6jtxpR7JKq8hcRsabyiHGcEDeT/view?usp=drivesdk

Waiting for your reply and a solution.

@runestubbe
Copy link
Owner

I tried building main.obj with Crinkler 2.3 using the arguments in your initial post and it seems to link, compress and run just fine here.

I wonder if the problem might stem from you using a different environment with different libs that causes Crinkler to produce an invalid executable. I'm running Crinkler from the VS2019 command prompt ("x86 Native Tools Command Prompt for VS 2019" in the start menu). What does your environment look like?

Alternatively, Crinkler executables might just not work on your machine for some reason. We have previously seen 3rd party software trying to scan Crinkler executables, getting confused and ultimately causing a crash. Can you try if the executable I built runs on our machine?
https://drive.google.com/file/d/1cv7wVkIQgitgyM7c8sUC1ZYFyH8b-h2o/view?usp=sharing

@galib45
Copy link
Author

galib45 commented Aug 16, 2020

I ran the out.exe that you provided. It crashed with the same error code. Is it a problem with my os? I am running Windows 7 Ultimate Service Pack 1.

@runestubbe
Copy link
Owner

That is interesting. As far as we know, Crinkler should still be compatible with Windows 7, although I don't think we have ever tested the Ultimate Edition specifically.

It might also be related to 3rd party software. We have previously seen graphics drivers scanning executables to detect which game-specific optimizations to apply. Which graphics card / driver are you using? Do you have any unusual programs installed? Anti-virus software, etc?

Most programs won't start automatically when you start windows in safe mode. Can you try running out.exe in safe mode to help narrow it down?

@galib45
Copy link
Author

galib45 commented Aug 21, 2020

I ran the executable out.exe in safe mode and it crashed with a different error message.

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	out.exe
  Application Version:	0.0.0.0
  Application Timestamp:	6a2da30f
  Fault Module Name:	ntdll.dll
  Fault Module Version:	6.1.7601.19135
  Fault Module Timestamp:	56a1c682
  Exception Code:	80000003
  Exception Offset:	000a49bd
  OS Version:	6.1.7601.2.1.0.256.1
  Locale ID:	1033
  Additional Information 1:	0a9e
  Additional Information 2:	0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:	0a9e
  Additional Information 4:	0a9e372d3b4ad19135b953a78882e789

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

But when I ran it in normal mode, it gave this error message

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	out.exe
  Application Version:	0.0.0.0
  Application Timestamp:	6a2da30f
  Fault Module Name:	out.exe
  Fault Module Version:	0.0.0.0
  Fault Module Timestamp:	6a2da30f
  Exception Code:	c0000005
  Exception Offset:	00020053
  OS Version:	6.1.7601.2.1.0.256.1
  Locale ID:	1033
  Additional Information 1:	0a9e
  Additional Information 2:	0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:	0a9e
  Additional Information 4:	0a9e372d3b4ad19135b953a78882e789

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt

@galib45
Copy link
Author

galib45 commented Aug 21, 2020

When I opened it in OLYDBG, it gave the following error

crash

@askeksa
Copy link
Collaborator

askeksa commented Aug 26, 2020

Those crash summaries give a useful hint about what goes on. In particular, Exception Offset: 00020053 from the second summary indicates at which instruction it crashes:

The Crinkler import code crashes while reading the name of one of the functions in one of the imported DLLs (to compute a hash of the name). This would seem to indicate that one of those DLLs is shaped in an untraditional way that the Crinkler import code does not understand.

Can you make available the gdi32.dll, kernel32.dll, ntdll.dll and user32.dll files from your C:\Windows\SysWOW64 folder? Then we can inspect those to see what is different on your system.

@galib45
Copy link
Author

galib45 commented Aug 26, 2020

Okay. I'll make an archive and upload it on drive and provide the link. Thanks for your reply.

@galib45
Copy link
Author

galib45 commented Dec 2, 2020

On a different note, I am on a 32 bit windows system. I have system32 folder but no syswow64

@askeksa
Copy link
Collaborator

askeksa commented Dec 2, 2020

Interesting. That could very well be related to the error. I think it's been quite a while since we last tested on a 32-bit Windows.

C:\Windows\system32 it is, then. Same DLLs.

@galib45
Copy link
Author

galib45 commented Dec 3, 2020

Thank you so much for your quick reply. I have included all the dlls you asked and also the source code and build script of my project.

Drive link:
https://drive.google.com/file/d/1CxmgjDP7cY-AmJjI84Nzjs7E_hIAvHmZ/view?usp=drivesdk

@galib45
Copy link
Author

galib45 commented Dec 3, 2020

Another thing I have just found. The output executable tries to eat up all the available memory.

memory-eating

@askeksa
Copy link
Collaborator

askeksa commented Dec 3, 2020

Did you link that executable with /TINYHEADER? If not, a memory usage of 500MB (512,000 K) is normal, as this is the default size of the decompression hash table. You can reduce it with the /HASHSIZE option.

Since the program also crashes with /TINYHEADER, the memory usage is probably not the cause of the problem.

@askeksa
Copy link
Collaborator

askeksa commented Jul 29, 2022

I took a look at the DLL files in your archive, and I can't see anything wrong with them. It's probably some weirdnees with your system. Can you run other Crinkler-compressed executables, i.e. any 4k intro?

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

3 participants