38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
|
--- src/teximage.c.orig Sun Mar 7 19:15:47 1999
|
||
|
+++ src/teximage.c Sun Mar 7 19:15:52 1999
|
||
|
@@ -279,6 +282,16 @@
|
||
|
|
||
|
|
||
|
|
||
|
+/* Need this to prevent an out-of-bounds memory access when using
|
||
|
+ * X86 optimized code.
|
||
|
+ */
|
||
|
+#ifdef USE_X86_ASM
|
||
|
+# define EXTRA_BYTE 1
|
||
|
+#else
|
||
|
+# define EXTRA_BYTE 0
|
||
|
+#endif
|
||
|
+
|
||
|
+
|
||
|
/*
|
||
|
* Given a gl_image, apply the pixel transfer scale, bias, and mapping
|
||
|
* to produce a gl_texture_image. Convert image data to GLubytes.
|
||
|
@@ -328,7 +341,7 @@
|
||
|
texImage->Height2 = 1 << texImage->HeightLog2;
|
||
|
texImage->Depth2 = 1 << texImage->DepthLog2;
|
||
|
texImage->MaxLog2 = MAX2( texImage->WidthLog2, texImage->HeightLog2 );
|
||
|
- texImage->Data = (GLubyte *) malloc( numPixels * components );
|
||
|
+ texImage->Data = (GLubyte *) malloc( numPixels * components + EXTRA_BYTE );
|
||
|
|
||
|
if (!texImage->Data) {
|
||
|
/* out of memory */
|
||
|
@@ -775,7 +788,7 @@
|
||
|
/* XXX should we really allocate memory for the image or let it be NULL? */
|
||
|
/*texImage->Data = NULL;*/
|
||
|
|
||
|
- texImage->Data = (GLubyte *) malloc( numPixels * components );
|
||
|
+ texImage->Data = (GLubyte *) malloc( numPixels * components + EXTRA_BYTE );
|
||
|
|
||
|
/*
|
||
|
* Let's see if anyone finds this. If glTexImage2D() is called with
|