Bug 17560 - Fix some compilation warning and some 32/64 errors
Summary: Fix some compilation warning and some 32/64 errors
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-13 02:54 UTC by Guillaume Melquiond
Modified: 2009-08-24 12:30 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Fixes some warning messages (8.38 KB, patch)
2008-09-13 02:55 UTC, Guillaume Melquiond
Details | Splinter Review

Description Guillaume Melquiond 2008-09-13 02:54:09 UTC
I tried to perform a -Werror build of mesa. Obviously, it was a failure,
but it at least exhibited a few genuine errors. The attached patch fixes
some of them. (Note: The only DRI drivers that were built were i915 and
swrast.)

* First of all, here are the issues that I didn't fix:

In sample_depth_texture at swrast/s_texfilter.c:2862, when the magnitude
filter is not GL_NEAREST, when the texture is GL_TEXTURE_RECTANGLE_ARB
(or GL_TEXTURE_1D_ARRAY_EXT but this one may not matter), and when the
compare function is GL_NONE, then the coordinates u and v are
uninitialized at line 3178.

At dri/intel/intel_tex_image.c:212, the try_pbo_upload function does not
test if the pixel data are in the lower 32-bit address space. So it can
lead to garbage being uploaded when the user calls TexImage, since the
address is truncated.

I have not looked in depth into it, but the same issue may arise for
intel_pixel_read.c and intel_pixel_draw.c.

* And then, the issues that I fixed in the patch:

At glx/x11/indirect_vertex_program.c:196, the get_attrib_array_data
function writes a GLintptr (potentially 8 bytes) at address params, while
the user may only expect a GLint (4 bytes), hence overwriting 4 bytes of
user memory. The patch fixes it by using the same code structure for the
three __indirect_glGetVertexAttrib[ifv]vARB functions.

At dri/i915/i915_debug.c:180, the code implicitly relies on ~0UL to be
32-bit long, so that the mask is correctly computed. The patch fixes by
using the explicit constant, so that the behavior does not depend on the
architecture.

The header file stdio.h is now included in glapi/glthread.c, so that
the perror function is declared. In particular, its argument is a
pointer, not an integer, which have different sizes depending on the
architecture.

In main/texformat_tmp.h and swrast/s_texfilter.c, some functions are made
to return earlier in case of errors, so that uninitialized variables
(due to the errors) are not used later.

At xdemos/glxinfo.c:449, XDestroyWindow is called while no window was
ever created. The patch removes it.

In glu/sgi/libnurbs and progs/demos/rain.cxx, string literals are used to
initialize pointers to mutable data. So the patch adds a few "const"
qualifiers.
Comment 1 Guillaume Melquiond 2008-09-13 02:55:32 UTC
Created attachment 18856 [details] [review]
Fixes some warning messages
Comment 2 Brian Paul 2008-09-13 13:27:30 UTC
Thanks!  I'm committing your patches.
Comment 3 Adam Jackson 2009-08-24 12:30:50 UTC
Mass version move, cvs -> git


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.