Hi!
Didn't found info how/where to report bugs, so going to share some findings on the forum. Btw what's the proper way to report bugs?
I'm trying to use AngelScript in my pet project, for now getting familiar with AS.
Using AngelScript 2.33.1 (50229f5 github commit), Linux x86-64, gcc 8.3.0.
1) AddressSanitizer: heap-buffer-overflow. (+-1 byte error)
AddressSanitizer detects read of unallocated memory at line (strcmp compares null-terminated strings)
The memory allocated here is not correct when "in_length = strlen(in_code);", strlen doesn't count null-char.
Fix that works for me:
code = asNEWARRAY(char, in_length + 1);
if( code == 0 )
return asOUT_OF_MEMORY;
memcpy(code, in_code, in_length);
code[in_length] = '\0';
But if this part of AS works only with null-terminated strings than maybe strcpy (deals with null-char) should replace memcpy?
2) asMETHOD with method of a base class.
asMETHOD doesn't detect ptrdiff_t for member function of base class, it's always 0. Workaround is to abuse asMETHODPR as much as possible.
Attached online_gcc_8.cpp example (compatible with http://cpp.sh/)