BearKidsTeam / VirtoolsScriptDeobfuscation

Other
10 stars 2 forks source link

Buffer overflow for large scripts #8

Closed tomysshadow closed 1 year ago

tomysshadow commented 1 year ago

Currently, the Generator's buffer is always allocated to 1 MB, with the assumption that scripts will always be less than that size.

char *buffer = new char[1048576];

However, if a script has enough building blocks it can overflow the buffer. Attached is an NMO file - modified from a VMO file - for the webgame Backyardigans: Super Spy Adventure. The script MASTER_GAME has over 6000 building blocks, and overflows the buffer, causing an exception. Tacking an extra digit on the end of the size does fix the issue, but the ideal would be be calculate the correct size in advance. (note: needs to be opened in Virtools 5.0 to avoid error message about missing DLLs - doing so works as long as you've applied Pull Request #7 and compile using the 5.0 SDK)

SuperSpy_master.zip