mi: NULL-protect miFillGeneralPoly()

| In file included from ../mi/mipoly.c:59:
| ../mi/mipoly.c: In function ‘miFillGeneralPoly’:
| ../mi/mipoly.h:162:12: warning: dereference of NULL ‘pAET’ [CWE-476] [-Wanalyzer-null-dereference]
|   162 |    if (pAET->ymax == y) {          /* leaving this edge */ \
| ../mi/mipoly.c:591:17: note: in expansion of macro ‘EVALUATEEDGEEVENODD’
|   591 |                 EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
|       |                 ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-06 14:43:04 +02:00
parent fccc98645b
commit 3b9ca877a4
2 changed files with 5 additions and 2 deletions

View File

@ -587,8 +587,10 @@ miFillGeneralPoly(DrawablePtr dst, GCPtr pgc, int count, DDXPointPtr ptsIn)
width = FirstWidth;
nPts = 0;
}
EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
if (pAET != NULL) { // FIXME: somewhow analyzer still complains
EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
}
}
miInsertionSort(&AET);
}

View File

@ -159,6 +159,7 @@ typedef struct _ScanLineListBlock {
* The even-odd rule is in effect.
*/
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \
assert(pAET); \
if (pAET->ymax == y) { /* leaving this edge */ \
pPrevAET->next = pAET->next; \
pAET = pPrevAET->next; \