
as3-arduino-connector - issue #34
Memory corruption if readByte() is called when not data available
What steps will reproduce the problem? 1. call readByte() when no data is available
What version of the product are you using? On what operating system? 1.5.0
Please provide any additional information below.
FREObject getByte(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) { FREObject result;
pthread_mutex_lock( &safety); FRENewObjectFromUint32(buffer[0], &result);
memcpy(buffer,buffer+1,bufferSize-1);
bufferSize--;
if (bufferSize == 0)
{
sentEvent = 0;
}
pthread_mutex_unlock( &safety);
return result; }
No check for bufferSize>0 before decrement. buffersize became nagative. Incoming bytes corrupt ptrToThread variable. On AS3 side, __bytesAvailable became negative.
Comment #1
Posted on Apr 14, 2015 by Happy BearThis project has been moved to GitHub by Google Code. https://github.com/quetwo/as3-arduino-connector Would you mind submitting a pull request there to correct these issues? I would love to include them in a new release.
Status: New
Labels:
Type-Defect
Priority-Medium