View Issue Details

IDProjectCategoryView StatusLast Update
0013256Runner[All Projects] HTML5Public2017-07-26 15:59
ReporterSeekerAssigned ToMike Dailly 
PriorityMediumSeverityC - GeneralReproducibility100%
Status ClosedResolutionFixed 
PlatformHTML5OSWindows 7OS Version
Product Version 
Target VersionFixed in Version 
Summary0013256: HTML5: HTML5 Obfuscator Causes Syntax Errors [when X - -Y, as it reads code as X-- Y]
DescriptionHere is code that will compile properly (arbitrary example):

b = 1;
a = (1 - -b);

But after the HTML5 obfuscator kicks in, the code will be turned into:

_inst.gmlb=1;
_inst.gmla=(1--_inst.gmlb); // syntax error

That causes a syntax error in the browser ("SyntaxError: invalid decrement operand"), because the two minuses in the original code which were initially separate and correct are being joined together incorrectly.

Note that this issue would also be a runtime error as a result of the obfuscation if two pluses were used instead of minuses (and be an "invalid increment operand" error), as in:

a = (1 + +b);

These issues only occur when the right operand of the calculation is a variable. If the right operand is a constant (a number or a defined constant), as in:

a = (1 - -2);

Then no error occurs because the compiler will automatically translate it into:

a = 3;

Of course, an option to not have code be obfuscated would be nice too.

https://yoyogames.zendesk.com/attachments/token/mp1oepffsmmoarf/?name=HTML5ObfuscationSyntaxError.gmz
Additional InformationOriginal helpdesk ticket: http://help.yoyogames.com/tickets/48953
1.4 Found In1.2.1220
2.x Runtime Found In
2.x Runtime Verified In

Activities

Daniel Cleaton

2014-01-13 18:01

Adminstrator   ~0026952

Note also that on neither platform will a = -b give you -1.

Mike Dailly

2014-01-14 13:06

Manager   ~0026985

For now, surround in brackets, and it'll work fine.

b = 1;
a = (1 - (-b));

Mike Dailly

2017-06-13 20:48

Manager   ~0053601

fixed

Sam Cumming

2017-07-26 15:59

Adminstrator   ~0054603

Verified > 1.4.1769 - Closing.