bug fix in syncedprot.c (treat stackoverflow correctly)

This commit is contained in:
2014-10-29 15:59:12 +01:00
parent b319461531
commit a0ea2d5745

View File

@ -163,10 +163,10 @@ long SyncedBegin(long syncid)
return SYNCED_NO_MEMORY;
}
}
sp++;
if (sp >= NSTACK) {
return SYNCED_STACK_OVERFLOW;
}
sp++;
sync->count++;
actualSync = sync;
return sync->id;
@ -181,13 +181,13 @@ long SyncedEnd(long syncid)
if (sp <= 0) {
return SYNCED_STACK_UNDERFLOW;
}
sync = actualSync;
sp--;
sync = actualSync;
actualSync = stack[sp];
sync->count--;
if (sync->count < 0) {
if (sync->count <= 0) {
return SYNCED_COUNT_UNDERFLOW;
}
sync->count--;
if (syncid != 0 && syncid != sync->id) {
return SYNCED_ID_MISMATCH;
}