IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32746


Ignore:
Timestamp:
Nov 22, 2011, 10:17:57 AM (15 years ago)
Author:
eugene
Message:

if we catch a memory block over/underrun, check the rest of the memory for corruption

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psMemory.c

    r32722 r32746  
    100100    PS_MEM_ABORT(__func__, "Unsafe to Continue\n"); \
    101101}
     102
     103static bool checkingForCorruption = false;
    102104
    103105static bool isBadMemBlock(FILE *output, const psMemBlock *memBlock, const char *file, unsigned int lineo, const char *func);
     
    746748        }
    747749        fprintf(output, _("\n\tMemory block is corrupted; buffer underflow detected.\n"));
     750        if (!checkingForCorruption) {
     751          p_psMemCheckCorruption(__FILE__, __LINE__, __func__, output, false);
     752        }
    748753        bad = true;
    749754    }
     
    755760        }
    756761        fprintf(output, _("\n\tMemory block is corrupted; buffer overflow detected.\n"));
     762        if (!checkingForCorruption) {
     763          p_psMemCheckCorruption(__FILE__, __LINE__, __func__, output, false);
     764        }
    757765        bad = true;
    758766    }
     
    13041312    MUTEX_LOCK(&memBlockListMutex);
    13051313
     1314    // this function calls 'isBadMemBlock', which may in turn call this function : avoid nested calls or we will be stuck forever
     1315    checkingForCorruption = true;
     1316
    13061317    psS32 nbad = 0;               // number of bad blocks
    13071318    for (psMemBlock *memBlock = (psMemBlock *) lastMemBlockAllocated; memBlock != NULL; memBlock = memBlock->nextBlock) {
     
    13161327        }
    13171328    }
     1329
     1330    checkingForCorruption = true;
    13181331
    13191332    // release the lock on the memblock list
Note: See TracChangeset for help on using the changeset viewer.