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

Excessive memory usage - packing long code crashes the browser #46

Open
xem opened this issue Feb 23, 2016 · 6 comments
Open

Excessive memory usage - packing long code crashes the browser #46

xem opened this issue Feb 23, 2016 · 6 comments
Assignees
Labels
Milestone

Comments

@xem
Copy link

xem commented Feb 23, 2016

I've encountered this problem a few times this month.
I have a long minified code (~3kb) containing a lot of repetitions, and when I try to regpack it in any browser, I get no output, and the browser crashes. (Fx, Chrome, Edge, all the same).

Here's the code I want to pack:

b.innerHTML="<textarea rows=40 cols=99 id=p>";oninput=function(){j=p.value;j=j.replace(/([^]*)eval\(_\)$/,function(a,m){eval(m);return _});c=[];s=[];r=[];for(d=e=f=g=h=o=0;o!=j;)o=j,"/"==(k=j.match(/['"\/]/))?(l=j.indexOf(k),n=j.slice(0,l+1),j=j[l+1].match(/[\/*]$/)?j.replace(/\/\/.*|\/\*[^]*?\*\//,function(a){c.push(a);return"@C"+e++ +"@"}):!n.match(/([\d\)\]\}]|true|false|null|undefined|this|@S\d+@)\s*(@C\d+@)*\s*\//im)&&n.match(/([-,;=><+%*&|^~!?!:\[\(]|delete|typeof|void|in|instanceof|of|case|delete|else|return|throw|yield|debugger|continue|break|throw|return|@D@|^)\s*(@C\d+@)*\s*\//m)?j.replace(/\/(\\\\|\\\/|[^\/])+?\/[gimuy]*/,function(a){r.push(a);return"@R"+g++ +"@"}):j.replace("/","@D@")):j="'"==k?j.replace(/'(\\\\|\\'|[^'])*?'/,function(a){s.push(a);return"@S"+h++ +"@"}):j.replace(/"(\\\\|\\"|[^"])*?"/,function(a){s.push(a);return"@S"+h++ +"@"});j=j.replace(/@D@/g,"/");j=j.replace(/ *([-+*%=&|:?<>^/]+) */g," $1 ");j=j.replace(/ *, */g,", ");j=j.replace(/}/g,"\n}");j=j.replace(/ *([;{}]|(case|default).*?:) */g,"$1\n");j=j.replace(/[\r\n]+ */g,"\n");j=j.replace(/for\s*\([^;]*?;[^;]*?;[^]/g,function(a){return a.replace(/\n/g,"").replace(/;/g,"; ")});j=j.replace(/.*?([{}])?\n/g,function(a,m){m+="";if("{"==m[0])return"  ".repeat(d++)+a;"}"==m[0]&&d--;return"  ".repeat(d)+a});j=j.replace(/\n+/g,"\n");j=j.replace(/@C(\d+)@/g,function(a,m){return c[m]});j=j.replace(/@S(\d+)@/g,function(a,m){return s[m]});j=j.replace(/@R(\d+)@/g,function(a,m){return r[m]});p.value=j};b.innerHTML="<textarea rows=40 cols=99 id=p>";oninput=function(){j=p.value;j=j.replace(/([^]*)eval\(_\)$/,function(a,m){eval(m);return _});c=[];s=[];r=[];for(d=e=f=g=h=o=0;o!=j;)o=j,"/"==(k=j.match(/['"\/]/))?(l=j.indexOf(k),n=j.slice(0,l+1),j=j[l+1].match(/[\/*]$/)?j.replace(/\/\/.*|\/\*[^]*?\*\//,function(a){c.push(a);return"@C"+e++ +"@"}):!n.match(/([\d\)\]\}]|true|false|null|undefined|this|@S\d+@)\s*(@C\d+@)*\s*\//im)&&n.match(/([-,;=><+%*&|^~!?!:\[\(]|delete|typeof|void|in|instanceof|of|case|delete|else|return|throw|yield|debugger|continue|break|throw|return|@D@|^)\s*(@C\d+@)*\s*\//m)?j.replace(/\/(\\\\|\\\/|[^\/])+?\/[gimuy]*/,function(a){r.push(a);return"@R"+g++ +"@"}):j.replace("/","@D@")):j="'"==k?j.replace(/'(\\\\|\\'|[^'])*?'/,function(a){s.push(a);return"@S"+h++ +"@"}):j.replace(/"(\\\\|\\"|[^"])*?"/,function(a){s.push(a);return"@S"+h++ +"@"});j=j.replace(/@D@/g,"/");j=j.replace(/ *([-+*%=&|:?<>^/]+) */g," $1 ");j=j.replace(/ *, */g,", ");j=j.replace(/}/g,"\n}");j=j.replace(/ *([;{}]|(case|default).*?:) */g,"$1\n");j=j.replace(/[\r\n]+ */g,"\n");j=j.replace(/for\s*\([^;]*?;[^;]*?;[^]/g,function(a){return a.replace(/\n/g,"").replace(/;/g,"; ")});j=j.replace(/.*?([{}])?\n/g,function(a,m){m+="";if("{"==m[0])return"  ".repeat(d++)+a;"}"==m[0]&&d--;return"  ".repeat(d)+a});j=j.replace(/\n+/g,"\n");j=j.replace(/@C(\d+)@/g,function(a,m){return c[m]});j=j.replace(/@S(\d+)@/g,function(a,m){return s[m]});j=j.replace(/@R(\d+)@/g,function(a,m){return r[m]});p.value=j}

I tried to pack it with all the options unchecked, but had the same problem.

Any idea?

Maybe the packer creates too many tokens and overflows out of ASCII and breaks everything?

(PS: I use the online packer regpack 4.0. Couldn't try command-line because... dunno how to install it)

(PS2: Strangely, this code, just a little shorter, packs well in ~957b:)

b.innerHTML="<textarea rows=40 cols=99 id=p>";oninput=function(){j=p.value;c=[];s=[];r=[];for(d=e=f=g=h=o=0;o!=j;)o=j,"/"==(k=j.match(/['"\/]/))?(l=j.indexOf(k),n=j.slice(0,l+1),j=j[l+1].match(/[\/*]$/)?j.replace(/\/\/.*|\/\*[^]*?\*\//,function(a){c.push(a);return"@C"+e++ +"@"}):!n.match(/([\d\)\]\}]|true|false|null|undefined|this|@S\d+@)\s*(@C\d+@)*\s*\//im)&&n.match(/([-,;=><+%*&|^~!?!:\[\(]|delete|typeof|void|in|instanceof|of|case|delete|else|return|throw|yield|debugger|continue|break|throw|return|@D@|^)\s*(@C\d+@)*\s*\//m)?j.replace(/\/(\\\\|\\\/|[^\/])+?\/[gimuy]*/,function(a){r.push(a);return"@R"+g++ +"@"}):j.replace("/","@D@")):j="'"==k?j.replace(/'(\\\\|\\'|[^'])*?'/,function(a){s.push(a);return"@S"+h++ +"@"}):j.replace(/"(\\\\|\\"|[^"])*?"/,function(a){s.push(a);return"@S"+h++ +"@"});j=j.replace(/@D@/g,"/");j=j.replace(/ *([-+*%=&|:?<>^/]+) */g," $1 ");j=j.replace(/ *, */g,", ");j=j.replace(/}/g,"\n}");j=j.replace(/ *([;{}]|(case|default).*?:) */g,"$1\n");j=j.replace(/[\r\n]+ */g,"\n");j=j.replace(/for\s*\([^;]*?;[^;]*?;[^]/g,function(a){return a.replace(/\n/g,"").replace(/;/g,"; ")});j=j.replace(/.*?([{}])?\n/g,function(a,m){m+="";if("{"==m[0])return"  ".repeat(d++)+a;"}"==m[0]&&d--;return"  ".repeat(d)+a});j=j.replace(/\n+/g,"\n");j=j.replace(/@C(\d+)@/g,function(a,m){return c[m]});j=j.replace(/@S(\d+)@/g,function(a,m){return s[m]});j=j.replace(/@R(\d+)@/g,function(a,m){return r[m]});p.value=j};b.innerHTML="<textarea rows=40 cols=99 id=p>";oninput=function(){j=p.value;j=j.replace(/([^]*)eval\(_\)$/,function(a,m){eval(m);return _});c=[];s=[];r=[];for(d=e=f=g=h=o=0;o!=j;)o=j,"/"==(k=j.match(/['"\/]/))?(l=j.indexOf(k),n=j.slice(0,l+1),j=j[l+1].match(/[\/*]$/)?j.replace(/\/\/.*|\/\*[^]*?\*\//,function(a){c.push(a);return"@C"+e++ +"@"}):!n.match(/([\d\)\]\}]|true|false|null|undefined|this|@S\d+@)\s*(@C\d+@)*\s*\//im)&&n.match(/([-,;=><+%*&|^~!?!:\[\(]|delete|typeof|void|in|instanceof|of|case|delete|else|return|throw|yield|debugger|continue|break|throw|return|@D@|^)\s*(@C\d+@)*\s*\//m)?j.replace(/\/(\\\\|\\\/|[^\/])+?\/[gimuy]*/,function(a){r.push(a);return"@R"+g++ +"@"}):j.replace("/","@D@")):j="'"==k?j.replace(/'(\\\\|\\'|[^'])*?'/,function(a){s.push(a);return"@S"+h++ +"@"}):j.replace(/"(\\\\|\\"|[^"])*?"/,function(a){s.push(a);return"@S"+h++ +"@"});j=j.replace(/@D@/g,"/");j=j.replace(/ *([-+*%=&|:?<>^/]+) */g," $1 ");j=j.replace(/ *, */g,", ");j=j.replace(/}/g,"\n}");j=j.replace(/ *([;{}]|(case|default).*?:) */g,"$1\n");j=j.replace(/[\r\n]+ */g,"\n");}
@Siorki
Copy link
Owner

Siorki commented Feb 23, 2016

Chrome grows to 750Mb then crashes.
It also happens with the original JsCrush and First Crush.

I recorded the same behavior on the prototype for v5.0 with a packer rewritten from scratch.
The debugger is able to unroll the loop up to the 1000th character before the crash.

@Siorki Siorki added the bug label Feb 23, 2016
@xem
Copy link
Author

xem commented Feb 23, 2016

Thanks for the analysis. (and glad to hear about an upcoming 5.0)

If it can help, I got the same issue while I was packing the js1k entry "jsotopes":

this version worked fine:

y=x=l=9;for(i in e=']��]����]�]��v�,]�]��t,D,�_�]��t.�`�]�]�tF�a�]�]�uE�d��tF b��vE�d�]�]�tF f|]�DtF�h|��tG g�]�tH�f�_�I c�]��uH�h�^�tH ]�f|]��vG�]�j�tH�D�]�i�vG�]�j�tJ h��u|tH�f�`�J"h��vK�i��M f�^�DtL�h|]�t|J�D j�tL�l�M�D ]�j�vK�D�k�vJ�D k�wL�]�k�vL�D k�wN�m�M�D _�c�`�vL�]�l�N�D ]�j�vN�l�N�D k|]�P�j|`�O ]�i�]�O�p�L�D"l��Pm�_�L�D"]�l�Q�n��N�D ]�]�j�Q�]�q�R p�tR�r�P�D$]�]�i�U�]�l�.Q�D h�_�,tT�m�.Q�D"k�uV�l�]�W"h�^�tX�l�X�m�tV�n�U�,�]�i�Xm�S�D.�]�]�g�uV�D�j�E|N,D,D,D"g�tDtX�h�S,D�D�D ]�e�uZ�f�L-K�D�D ]�c�tJ-Q�f�H.O�D"]�a�uD,D.T�e�|E-S,D"d�u-Y�e�/U,D.],b�v,D,D,U�c|]�2F-M,D,!]�a|]�|0D,V�]�b�5Q,D�D ]�a�v/|,I,O�d�4N|G�D"]�b�t0L|N�]�c�1D,U,D c�,t.D-T�],c�D3D,L6^�,|4M3`�7D,D,D,D4],b�8D4g�C],d�=D,g�|A],b�;F,e�.D|1D,D0],`�.D,J,c�.H,D.],],_�F,E,G,],0�x-H,D2]x]|�-|E|J-_|^�yD,D,D,D,D0]x]x�D,M.^x,�x,x/D,D,D-x,z�,D,D,K,y-�x|x2x,x]y,�Dx3y-y�{,x,x,y-y,�3x.y,�x.x,z|x|.x�3~-x,x�0|-y|.�/|/x-},�0x.x,y|x�1x.x,�,x-|x,x,��-z�x.�.x,�/�-�,')if(s=e.charCodeAt(i),26>s)y++,l=x=l+s-18;else{m=25;for(j in f=[0,4,14,24,25,23,4,4,4])m+=f[j],s>m&&(z=s-m,c.fillStyle="#"+(7*m-32));c.fillRect(4*x,550-4*y,4*z,4);x+=z}

But this one, crashed the packer:

y=x=l=9;for(i in']��]����]�]��v�,]�]��t,D,�_�]��t.�`�]�]�tF�a�]�]�uE�d��tF b��vE�d�]�]�tF f|]�DtF�h|��tG g�]�tH�f�_�I c�]��uH�h�^�tH ]�f|]��vG�]�j�tH�D�]�i�vG�]�j�tJ h��u|tH�f�`�J"h��vK�i��M f�^�DtL�h|]�t|J�D j�tL�l�M�D ]�j�vK�D�k�vJ�D k�wL�]�k�vL�D k�wN�m�M�D _�c�`�vL�]�l�N�D ]�j�vN�l�N�D k|]�P�j|`�O ]�i�]�O�p�L�D"l��Pm�_�L�D"]�l�Q�n��N�D ]�]�j�Q�]�q�R p�tR�r�P�D$]�]�i�U�]�l�.Q�D h�_�,tT�m�.Q�D"k�uV�l�]�W"h�^�tX�l�X�m�tV�n�U�,�]�i�Xm�S�D.�]�]�g�uV�D�j�E|N,D,D,D"g�tDtX�h�S,D�D�D ]�e�uZ�f�L-K�D�D ]�c�tJ-Q�f�H.O�D"]�a�uD,D.T�e�|E-S,D"d�u-Y�e�/U,D.],b�v,D,D,U�c|]�2F-M,D,!]�a|]�|0D,V�]�b�5Q,D�D ]�a�v/|,I,O�d�4N|G�D"]�b�t0L|N�]�c�1D,U,D c�,t.D-T�],c�D3D,L6^�,|4M3`�7D,D,D,D4],b�8D4g�C],d�=D,g�|A],b�;F,e�.D|1D,D0],`�.D,J,c�.H,D.],],_�F,E,G,],0�x-H,D2]x]|�-|E|J-_|^�yD,D,D,D,D0]x]x�D,M.^x,�x,x/D,D,D-x,z�,D,D,K,y-�x|x2x,x]y,�Dx3y-y�{,x,x,y-y,�3x.y,�x.x,z|x|.x�3~-x,x�0|-y|.�/|/x-},�0x.x,y|x�1x.x,�,x-|x,x,��-z�x.�.x,�/�-�,')if(s=']��]����]�]��v�,]�]��t,D,�_�]��t.�`�]�]�tF�a�]�]�uE�d��tF b��vE�d�]�]�tF f|]�DtF�h|��tG g�]�tH�f�_�I c�]��uH�h�^�tH ]�f|]��vG�]�j�tH�D�]�i�vG�]�j�tJ h��u|tH�f�`�J"h��vK�i��M f�^�DtL�h|]�t|J�D j�tL�l�M�D ]�j�vK�D�k�vJ�D k�wL�]�k�vL�D k�wN�m�M�D _�c�`�vL�]�l�N�D ]�j�vN�l�N�D k|]�P�j|`�O ]�i�]�O�p�L�D"l��Pm�_�L�D"]�l�Q�n��N�D ]�]�j�Q�]�q�R p�tR�r�P�D$]�]�i�U�]�l�.Q�D h�_�,tT�m�.Q�D"k�uV�l�]�W"h�^�tX�l�X�m�tV�n�U�,�]�i�Xm�S�D.�]�]�g�uV�D�j�E|N,D,D,D"g�tDtX�h�S,D�D�D ]�e�uZ�f�L-K�D�D ]�c�tJ-Q�f�H.O�D"]�a�uD,D.T�e�|E-S,D"d�u-Y�e�/U,D.],b�v,D,D,U�c|]�2F-M,D,!]�a|]�|0D,V�]�b�5Q,D�D ]�a�v/|,I,O�d�4N|G�D"]�b�t0L|N�]�c�1D,U,D c�,t.D-T�],c�D3D,L6^�,|4M3`�7D,D,D,D4],b�8D4g�C],d�=D,g�|A],b�;F,e�.D|1D,D0],`�.D,J,c�.H,D.],],_�F,E,G,],0�x-H,D2]x]|�-|E|J-_|^�yD,D,D,D,D0]x]x�D,M.^x,�x,x/D,D,D-x,z�,D,D,K,y-�x|x2x,x]y,�Dx3y-y�{,x,x,y-y,�3x.y,�x.x,z|x|.x�3~-x,x�0|-y|.�/|/x-},�0x.x,y|x�1x.x,�,x-|x,x,��-z�x.�.x,�/�-�,'.charCodeAt(i),26>s)y++,l=x=l+s-18;else{m=25;for(j in f=[0,4,14,24,25,23,4,4,4])m+=f[j],s>m&&(z=s-m,c.fillStyle="#"+(7*m-32));c.fillRect(4*x,550-4*y,4*z,4);x+=z}

The only difference between both versions is that in the second one, I reuse the long string twice instead of assigning it to the variable e

@Siorki
Copy link
Owner

Siorki commented Feb 23, 2016

Can you please post base64-encoded strings for those two versions of jsotopes ? Control characters are not supported by GitHub's bugtracker.

@tomhodgins
Copy link

Hi guys!

I just tried running Maxime's string on my web server using Node on the CLI and I (eventually) was able to successfully output a packed file.

This doesn't seem to be a problem with RegPack, but rather just the limitations of the browser :)

@xem
Copy link
Author

xem commented Feb 23, 2016

jsotopes short base64'd in utf-8:

eT14PWw9OTtmb3IoaSBpbiBlPSddER9dHRMfGl0aXRsRdh8sXRpdGhN0LEQsHl8aXRoSdC4fYBpdGl0TdEYfYRpdGl0TdUUfZBsTdEYgYh0TdkUeZBpdGl0TdEYgZnxdE0R0Rh5ofBoSdEcgZxtdE3RIHmYbXxJJIGMdXRsTdUgeaBpeE3RIIF0eZnxdGhN2Rx5dHmoTdEgeRB5dHmkTdkceXR5qE3RKIGgaE3V8dEgeZhpgFEoiaBoSdkseaRoTTSBmGl4TRHRMHmh8XRJ0fEoeRCBqFXRMHmwQTR5EIF0eahV2Sx5EHmsTdkoeRCBrE3dMHl0eaxN2TB5EIGsTd04ebRVNHkQgXx5jGmAUdkweXR5sE04eRCBdHmoTdk4ebBNOHkQga3xdFFAeanxgE08gXR5pG10UTx5wE0weRCJsGhNQbRpfE0weRCJdHmwTUR5uGhNOHkQgXR5dHmoTUR5dHnETUiBwE3RSHnITUB5EJF0eXR5pFVUeXR5sEy5RHkQgaBpfFCx0VB5tEi5RHkQiaxR1Vh5sGl0TVyJoGl4UdFgebBNYHm0TdFYebhRVHywfXR5pE1htE1MeRC4fXR5dHmcTdVYeRB5qFUV8TixELEQsRCJnEnREdFgeaBRTLEQeRB5EIF0eZRN1Wh5mFEwtSx5EHkQgXR5jE3RKL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l8eBYxeC54LBYseC18eCx4LBJ/LXoZeC4SLngsFC8SLRQsJy5jaGFyQ29kZUF0KGkpLDI2PnMpeSsrLGw9eD1sK3MtMTg7ZWxzZXttPTI1O2ZvcihqIGluIGY9WzAsNCwxNCwyNCwyNSwyMyw0LDQsNF0pbSs9ZltqXSxzPm0mJih6PXMtbSxjLmZpbGxTdHlsZT0iIyIrKDcqbS0zMikpO2MuZmlsbFJlY3QoNCp4LDU1MC00KnksNCp6LDQpO3grPXp9DQo=

as @tomhodgins says (thanks and hi tommy), I think it's just a super-resource-consuming loop done by the packer that the browser doesn't like...

EDIT: for the record, the packed code that tommy managed to get is only 941b.

@xem xem closed this as completed Feb 23, 2016
@xem xem reopened this Feb 23, 2016
@Siorki Siorki added this to the 5.0 milestone Feb 23, 2016
@Siorki Siorki self-assigned this Feb 23, 2016
@Siorki
Copy link
Owner

Siorki commented Feb 23, 2016

The crusher stage is memory intensive. I'll perform a few more tests but I reckon the only way to fix this is to completely rewrite the algorithm. This is due for v5.0, see #7. I'll keep an eye on performance while working on the new one.

Update : I did not get the crash when packing jsotopes (long version). Both FF and Chrome coughed a little and required 400 Mb yet they went through. Maybe a smaller configuration will not support it. But I have a slight idea of what happened - the longest repeating string is 905b long. The crusher built a dictionary with one instance of that string, but then it had 2 strings of 904b, 3 of 903b and so on. The memory usage is o(n²). The goal for #7 is to keep only the longest relevant strings.

@Siorki Siorki changed the title Packing long code crashes the browser Excessive memory usage - packing long code crashes the browser Feb 24, 2016
@Siorki Siorki modified the milestones: 6.0, 5.0 Dec 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants