FreeFrame SDK bug

FFGL, OSC, GLSL. If you like abbreviations, this is the forum for you
Post Reply
dean

FreeFrame SDK bug

Post by dean »

This probably isn't the best place to post this, but I know some FreeFrame development happens here. The community page on freeframe is down, and I can't subscribe to the sourceforge mailing list.

I just spent a few hours debugging a pointer corruption, and it came down to a bug in the FreeFrame 1.5 SDK.

Patch attached. Hopefully will save some people the same troubles.

commit a09533545718a61883334c338db38ab2d2af58d4
Author: Dean McNamee <dean@gmail.com>
Date: Tue Mar 29 01:32:24 2011 +0100

Stupid static buffer overflow in %f formatting.

diff --git a/freeframe/FFGLSDK_1_5/Source/FFGLPlugins/FFGLPluginSDK.cpp b/freefr
index 45262fc..32f1bdf 100644
--- a/freeframe/FFGLSDK_1_5/Source/FFGLPlugins/FFGLPluginSDK.cpp
+++ b/freeframe/FFGLSDK_1_5/Source/FFGLPlugins/FFGLPluginSDK.cpp
@@ -22,7 +22,7 @@
#include <memory.h>

// Buffer used by the default implementation of getParameterDisplay
-static char s_DisplayValue[5];
+static char s_DisplayValue[50];


////////////////////////////////////////////////////////
@@ -58,7 +58,7 @@ char* CFreeFrameGLPlugin::GetParameterDisplay(DWORD dwIndex)
{
float fValue;
memcpy(&fValue, &dwValue, 4);
- memset(s_DisplayValue, 0, 5);
+ memset(s_DisplayValue, 0, sizeof(s_DisplayValue));
sprintf(s_DisplayValue, "%f", fValue);
return s_DisplayValue;
}

Post Reply