src/video/SDL_stretch.c
branchSDL-1.2
changeset 4355 9b464226e541
parent 4159 a1b03ba2fcd0
child 4356 ab2dfac9d5c1
--- a/src/video/SDL_stretch.c	Sun Oct 18 16:23:12 2009 +0000
+++ b/src/video/SDL_stretch.c	Sun Oct 18 17:31:37 2009 +0000
@@ -103,6 +103,13 @@
 		SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp);
 		return(-1);
 	}
+#ifdef HAVE_MPROTECT
+	/* Make the code writeable */
+	if ( mprotect(copy_row, sizeof(copy_row), PROT_READ|PROT_WRITE) < 0 ) {
+		SDL_SetError("Couldn't make copy buffer writeable");
+		return(-1);
+	}
+#endif
 	pos = 0x10000;
 	inc = (src_w << 16) / dst_w;
 	eip = copy_row;
@@ -128,8 +135,8 @@
 		return(-1);
 	}
 #ifdef HAVE_MPROTECT
-	/* Make the code executable */
-	if ( mprotect(copy_row, sizeof(copy_row), PROT_READ|PROT_WRITE|PROT_EXEC) < 0 ) {
+	/* Make the code executable but not writeable */
+	if ( mprotect(copy_row, sizeof(copy_row), PROT_READ|PROT_EXEC) < 0 ) {
 		SDL_SetError("Couldn't make copy buffer executable");
 		return(-1);
 	}