Bug 37648 - Logic error in mesa/main/teximage.c:texsubimage
Summary: Logic error in mesa/main/teximage.c:texsubimage
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
Depends on:
Reported: 2011-05-26 17:52 UTC by Ryan Sleevi
Modified: 2011-05-26 18:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Sleevi 2011-05-26 17:52:24 UTC
This was reported by a static analyzer tool run against the Chromium projects, which make use of Mesa. The downstream bug is http://code.google.com/p/chromium/issues/detail?id=84134

The original bug was reported against the Mesa used by Chromium, which is Mesa 7.6, and is as follows:

V501 There are identical sub-expressions to the left and to the right of the '&&' operator: width > 0 && height > 0 && height > 0 mesa teximage.c 2801

  else if (width > 0 && height > 0 && height > 0) {

However, this bug also exists in HEAD at http://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/main/teximage.c#n2696
in the refactored method:

static void
      else if (width > 0 && height > 0 && height > 0) {
         /* If we have a border, offset=-1 is legal.  Bias by border width. */

The issue is the additional height > 0 check. I'm uncertain if this is a redundant check, and can be eliminated, or if it should be checking depth > 0
Comment 1 Brian Paul 2011-05-26 18:24:23 UTC
It should be "depth > 0".  I'll fix it in git.  Thanks.
Comment 2 Brian Paul 2011-05-26 18:27:28 UTC
Fixed w/ commit 4609e80288bacf19af99b0ed7656eef9bb280912

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.