Mantis

View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013256Runner[All Projects] HTML5Public2014-01-10 14:292017-07-26 15:59
ReporterSeeker 
Assigned ToMike Dailly 
PriorityMediumSeverityC - GeneralReproducibility100%
StatusClosedResolutionFixed 
PlatformHTML5OSWindows 7OS 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 Version1.2.1220
2.x Runtime Version
2.x Runtime Version Verified In
Attached Files

- Relationships

-  Notes
(0026952)
Daniel Cleaton (Administrator)
2014-01-13 18:01

Note also that on neither platform will a = -b give you -1.
(0026985)
Mike Dailly (Manager)
2014-01-14 13:06

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

b = 1;
a = (1 - (-b));
(0053601)
Mike Dailly (Manager)
2017-06-13 20:48

fixed
(0054603)
Sam Cumming (Administrator)
2017-07-26 15:59

Verified > 1.4.1769 - Closing.


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker