Hard to describe compiled script crash bug

Report problems with documented functionality
rajat
Posts: 8
Joined: 07 Feb 2014, 13:35

Hard to describe compiled script crash bug

19 Dec 2014, 14:13

Greetings everyone,
Well here's a script that led to a weird compiled script crashing bug.
This extremely simple script runs flawlessly on my Win 7 x64 system with 1.1.16.05 ANSI installation. But if I compile it and run, it crashes.
Now the weirdest part, if I change just about anything in the script, ANYTHING, (like a section name or a command's old format), it compiles and runs ok.

Both ahk and exe zipped

I'm probably doing something stupid, I frequently do, but would like to know what exactly :)

Cheers
TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Hard to describe compiled script crash bug

19 Dec 2014, 17:06

It looks like your .exe is compressed. Using mpress? Mpress can sometimes produce .exe's that crash. Search the old forum for more information. I've switched back to using upx.exe for compression.

To do this, use this script as mpress.ahk and compile it, replacing mpress.exe in the AutoHotkey\compile folder. Download upx.exe and place in the same folder.

Code: Select all

#NoEnv                            ; For performance & future compatibility
#Warn                             ; For catching common errors
; ================================  Program  ===================================
file=%3%
Loop Read, % RegExReplace(file,"...$") "ahk"
  if (SubStr(A_LoopReadLine,1,12)=";@NoCompress")
    ExitApp
RunWait "%A_ScriptDir%\upx.exe" --best --all-methods "%3%"
; ==============================  End of file  =================================
(For faster compile, remove "--all-methods".)
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: Hard to describe compiled script crash bug

19 Dec 2014, 22:49

I think TAC109 is spot on. I can reproduce the problem by compiling with v1.1.16.05 ANSI, but only if mpress is enabled. It occurs with mpress v2.19 and v2.18, but not v1.27. It does not occur with v1.1.16.04 ANSI, though there's no difference between the two versions that could explain it. A bug in the mpress (de)compression code is the most likely explanation for how the slightest irrelevant-seeming change affects the result.
rajat
Posts: 8
Joined: 07 Feb 2014, 13:35

Re: Hard to describe compiled script crash bug

19 Dec 2014, 23:33

Alright, that clarifies it. I don't use compiled scripts too frequently, but this is the first time I came across such a bizarre issue with it, so thought I'd report.
Switching to UPX seems to be a good idea.

Thanks TAC109 and lexikos!

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 20 guests