From d9d787167795862909738892195fcdc751c413ed Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 10 May 2009 16:56:02 -0700 Subject: Doublecheck pictFormat is a supported format Fixes these warnings from parfait source checker: Error: Read buffer overflow at src/atimach64render.c:601 in function 'Mach64PrepareTexture' [Symbolic analysis] In array dereference of Mach64TexFormats[i] with index 'i' Array size is 6 elements (of 12 bytes each), index >= 0 and index <= 6 Error: Read buffer overflow at src/atimach64render.c:712 in function 'Mach64PrepareComposite' [Symbolic analysis] In array dereference of Mach64TexFormats[i] with index 'i' Array size is 6 elements (of 12 bytes each), index >= 0 and index <= 6 Signed-off-by: Alan Coopersmith --- src/atimach64render.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/atimach64render.c b/src/atimach64render.c index dda3938..1e9485e 100644 --- a/src/atimach64render.c +++ b/src/atimach64render.c @@ -598,6 +598,9 @@ Mach64PrepareTexture(PicturePtr pPict, PixmapPtr pPix) if (Mach64TexFormats[i].pictFormat == pPict->format) break; } + if (i == MACH64_NR_TEX_FORMATS) + MACH64_FALLBACK(("Unsupported picture format 0x%x\n", + (int)pPict->format)); texFormat = Mach64TexFormats[i].texFormat; /* Prepare picture size */ @@ -709,6 +712,9 @@ Mach64PrepareComposite if (Mach64TexFormats[i].pictFormat == pDstPicture->format) break; } + if (i == MACH64_NR_TEX_FORMATS) + MACH64_FALLBACK(("Unsupported picture format 0x%x\n", + (int)pPict->format)); dstFormat = Mach64TexFormats[i].dstFormat; m3d->dp_pix_width = SetBits(dstFormat, DP_DST_PIX_WIDTH) | -- cgit v1.2.3