Mesa (master): mesa: quiet down static analyzers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 30 10:59:36 UTC 2020


Module: Mesa
Branch: master
Commit: c3a251f254e51c173a9377be43bd5879703f022c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3a251f254e51c173a9377be43bd5879703f022c

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Fri Jul 24 19:51:30 2020 +0200

mesa: quiet down static analyzers

Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

---

 src/mesa/main/fbobject.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 55f2fe9bf42..c8735d0459a 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -296,6 +296,7 @@ get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
           || (i > 0 && ctx->API == API_OPENGLES)) {
          return NULL;
       }
+      assert(BUFFER_COLOR0 + i < ARRAY_SIZE(fb->Attachment));
       return &fb->Attachment[BUFFER_COLOR0 + i];
    case GL_DEPTH_STENCIL_ATTACHMENT:
       if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
@@ -5027,6 +5028,7 @@ get_fb_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
       const unsigned i = attachment - GL_COLOR_ATTACHMENT0;
       if (i >= ctx->Const.MaxColorAttachments)
          return NULL;
+      assert(BUFFER_COLOR0 + i < ARRAY_SIZE(fb->Attachment));
       return &fb->Attachment[BUFFER_COLOR0 + i];
    }
    case GL_DEPTH:



More information about the mesa-commit mailing list