mirror of
https://github.com/preble/libpinproc
synced 2026-02-22 18:15:25 +01:00
libpinproc: fixed uninitialized memory that could cause memory consumption leading to a crash.
pypinproc: changed linker path to point to ../bin. Added note about running in 64-bit environment (Snow Leopard). pyprocgame: debug printing enhancements jdtest: Fixed bug (not clearing out drop target mode). Added initial Splash.dmd.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
bin/
|
||||||
build/
|
build/
|
||||||
*/*.pbxuser
|
*/*.pbxuser
|
||||||
*/*.perspectivev3
|
*/*.perspectivev3
|
||||||
|
|||||||
@@ -86,10 +86,11 @@ PRResult PRDevice::Reset(uint32_t resetFlags)
|
|||||||
// Make sure the free list is empty.
|
// Make sure the free list is empty.
|
||||||
while (!freeSwitchRuleIndexes.empty()) freeSwitchRuleIndexes.pop();
|
while (!freeSwitchRuleIndexes.empty()) freeSwitchRuleIndexes.pop();
|
||||||
|
|
||||||
|
memset(switchRules, 0x00, sizeof(PRSwitchRuleInternal) * maxSwitchRules);
|
||||||
|
|
||||||
for (i = 0; i < kPRSwitchRulesCount; i++)
|
for (i = 0; i < kPRSwitchRulesCount; i++)
|
||||||
{
|
{
|
||||||
PRSwitchRuleInternal *switchRule = &switchRules[i];
|
PRSwitchRuleInternal *switchRule = &switchRules[i];
|
||||||
memset(switchRule, 0x00, sizeof(PRSwitchRule));
|
|
||||||
|
|
||||||
uint16_t ruleIndex = i;
|
uint16_t ruleIndex = i;
|
||||||
ParseSwitchRuleIndex(ruleIndex, &switchRule->switchNum, &switchRule->eventType);
|
ParseSwitchRuleIndex(ruleIndex, &switchRule->switchNum, &switchRule->eventType);
|
||||||
@@ -454,6 +455,12 @@ PRResult PRDevice::SwitchUpdateRule(uint8_t switchNum, PREventType eventType, PR
|
|||||||
{
|
{
|
||||||
oldRule = GetSwitchRuleByIndex(oldRule->linkIndex);
|
oldRule = GetSwitchRuleByIndex(oldRule->linkIndex);
|
||||||
freeSwitchRuleIndexes.push(oldRule->linkIndex);
|
freeSwitchRuleIndexes.push(oldRule->linkIndex);
|
||||||
|
|
||||||
|
if (freeSwitchRuleIndexes.size() > 128) // Detect a corrupted link-related values before it eats up all of the memory.
|
||||||
|
{
|
||||||
|
PRSetLastErrorText("Too many free switch rule indicies!");
|
||||||
|
return kPRFailure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now let's setup the first actual rule:
|
// Now let's setup the first actual rule:
|
||||||
|
|||||||
Reference in New Issue
Block a user