diff options
| author | Dave Hibberd <hibby@debian.org> | 2026-03-08 02:27:14 +0000 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2026-03-08 02:27:14 +0000 |
| commit | 7aa6cec9300c8a3e9ef98b19791ad324d487512e (patch) | |
| tree | 18c0487da11274dc1c4b67787ef12b1cefa15ae8 /CommonCode.c | |
| parent | dae2bbc7215a8361e7b9092e6c307491c7e5722a (diff) | |
New upstream version 6.0.25.33+repackupstream/6.0.25.33+repack
Diffstat (limited to 'CommonCode.c')
| -rw-r--r-- | CommonCode.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/CommonCode.c b/CommonCode.c index 26dda97..eb6c011 100644 --- a/CommonCode.c +++ b/CommonCode.c @@ -395,16 +395,54 @@ BOK1: return 0;
}
+
+void CheckFreeQueue(char * File, int Line)
+{
+ void ** pointer;
+ int n = 0;
+ void ** debug;
+ PMESSAGE Test;
+
+ pointer = FREE_Q;
+ debug = &FREE_Q;
+
+ while (pointer)
+ {
+ // Validate pointer to make sure it is in pool - it may be a duff address if Q is corrupt
+
+ Test = (PMESSAGE)pointer;
+
+ if (Test->GuardZone || (uintptr_t)pointer < (uintptr_t)BUFFERPOOL || (uintptr_t)pointer > (uintptr_t)ENDBUFFERPOOL)
+ {
+ // Not pointing to a buffer . debug points to the buffer that this is chained from
+
+ Debugprintf("CheckFree Queue Pool Corruption n = %d, ptr %p prev %p from %s Line %d", n, pointer, debug, File, Line);
+ }
+
+ debug = pointer;
+ pointer = pointer[0];
+ n++;
+
+ if (n > 1000)
+ {
+ Debugprintf("CheckFreeQueue Loop searching free chain - pointer = %p %p from %s Line %d", debug, pointer, File, Line);
+ FindLostBuffers();
+ WriteMiniDump();
+ Restart();
+ }
+ }
+}
+
int _C_Q_ADD(VOID *PQ, VOID *PBUFF, char * File, int Line)
{
void ** Q;
void ** BUFF = PBUFF;
void ** next;
PMESSAGE Test;
-
-
int n = 0;
+ CheckFreeQueue(File, Line);
+
// PQ may not be word aligned, so copy as bytes (for ARM5)
Q = PQ;
@@ -532,6 +570,8 @@ VOID * _GetBuff(char * File, int Line) char * fptr = 0;
unsigned char * byteaddr;
+ CheckFreeQueue(File, Line);
+
Temp = Q_REM(&FREE_Q);
// FindLostBuffers();
|
