Michel, can you review this patch for correctness, or at least
plausibility?
On Sun, Oct 27, 2002 at 06:56:35PM +0100, Michael Karcher wrote:
> Package: xlibmesa3
> Version: 4.2.1-2
> Severity: normal
> Tags: patch
>
> There are some minor bugs that cause the mesa library to access bad memory
> when using special parameters. This fixes issues for
> - Converting a 1x2 texture to a 16 bit per pixel format
> - Uninitialized variables in some code path
> - Access (this time read only) behind texture data for linear interpolation
> when auto-generating mip-maps.
> All these three bugs appear when running Warcraft III in wine.
>
> (This patch is ready for inclusion in debian/patchs in the X sources)
>
> diff -urN xc/extras/Mesa/src/cva.c xc/extras/Mesa/src/cva.c
> --- xc/extras/Mesa/src/cva.c Fri May 18 18:59:53 2001
> +++ xc/extras/Mesa/src/cva.c Fri Aug 23 19:53:30 2002
> @@ -546,9 +546,6 @@
> elt->stride = sizeof(GLuint);
> elt->flags = 0;
> } else {
> - elt->data = cva->store.Elt;
> - elt->stride = sizeof(GLuint);
> -
> if (cva->elt_count > cva->elt_size)
> {
> while (cva->elt_count > (cva->elt_size *= 2)) {};
> @@ -556,6 +553,9 @@
> cva->store.Elt = (GLuint *) MALLOC(cva->elt_size *
> sizeof(GLuint));
> }
> + elt->data = cva->store.Elt;
> + elt->stride = sizeof(GLuint);
> +
> cva->EltFunc( elt->data, &cva->Elt, 0, cva->elt_count );
> }
> elt->start = VEC_ELT(elt, GLuint, 0);
> @@ -812,8 +812,8 @@
> VB->FlagMax = n;
> }
>
> - VB->Flag[n] |= VERT_END_VB;
> }
> + VB->Flag[n] |= VERT_END_VB;
> }
>
> void gl_cva_force_precalc( GLcontext *ctx )
> diff -urN xc/extras/Mesa/src/texutil.c xc/extras/Mesa/src/texutil.c
> --- xc/extras/Mesa/src/texutil.c Sat May 19 02:03:18 2001
> +++ xc/extras/Mesa/src/texutil.c Fri Aug 23 23:16:50 2002
> @@ -1092,7 +1092,7 @@
> if ( convert_needs_packing( packing, format, type ) )
> convert.index |= CONVERT_PACKING_BIT;
>
> - if ( width != imageWidth )
> + if ( width != imageWidth || width & 3)
> convert.index |= CONVERT_STRIDE_BIT;
>
> return gl_convert_texsubimage2d_tab[mesaFormat]( &convert );
> diff -urN xc/extras/ogl-sample/main/gfx/lib/glu/libutil/mipmap.c xc/extras/ogl-sample/main/gfx/lib/glu/libutil/mipmap.c
> --- xc/extras/ogl-sample/main/gfx/lib/glu/libutil/mipmap.c Thu Feb 1 09:44:54 2001
> +++ xc/extras/ogl-sample/main/gfx/lib/glu/libutil/mipmap.c Fri Aug 23 23:45:38 2002
> @@ -1470,9 +1470,11 @@
> }
> temp += group_size;
> percent = y_percent * highx_float;
> - for (k = 0, temp_index = temp; k < components;
> - k++, temp_index += element_size) {
> - totals[k] += (GLubyte)(*(temp_index)) * percent;
> + if(highx_float != 0) { /* Skip after-last pixel */
> + for (k = 0, temp_index = temp; k < components;
> + k++, temp_index += element_size) {
> + totals[k] += (GLubyte)(*(temp_index)) * percent;
> + }
> }
>
>
> @@ -1524,9 +1526,11 @@
> }
> temp += group_size;
> percent = y_percent * highx_float;
> - for (k = 0, temp_index = temp; k < components;
> - k++, temp_index += element_size) {
> - totals[k] += (GLubyte)(*(temp_index)) * percent;
> + if(highx_float != 0) {
> + for (k = 0, temp_index = temp; k < components;
> + k++, temp_index += element_size) {
> + totals[k] += (GLubyte)(*(temp_index)) * percent;
> + }
> }
> } else {
> percent = (highy_float-lowy_float)*(highx_float-lowx_float);
>
>
> -- System Information
> Debian Release: 3.0
> Architecture: i386
> Kernel: Linux achilles.karcher.de 2.4.18 #1 Don Aug 15 23:15:36 CEST 2002 i686
> Locale: LANG=de_DE.ISO-8859-1, LC_CTYPE=de_DE.ISO-8859-1
>
> Versions of packages xlibmesa3 depends on:
> ii debconf 1.0.32 Debian configuration management sy
> ii libc6 2.2.5-14.3.0.1 GNU C Library: Shared libraries an
> ii libstdc++2.10-glibc2.2 1:2.95.4-7 The GNU stdc++ library
> ii xlibs 4.2.1-2 X Window System client libraries
>
>
--
G. Branden Robinson | One doesn't have a sense of humor.
Debian GNU/Linux | It has you.
branden@debian.org | -- Larry Gelbart
http://people.debian.org/~branden/ |
Attachment:
pgpxGfLEfZ5XT.pgp
Description: PGP signature