Browse Source

fix possible memory corruption

Wei Mingzhi 10 years ago
parent
commit
f2b5ec963a
1 changed files with 8 additions and 1 deletions
  1. 8 1
      font.c

+ 8 - 1
font.c

@@ -310,7 +310,14 @@ PAL_DrawASCIICharOnSurface(
       {
          if (pChar[i] & (1 << j))
          {
-            ((LPBYTE)(lpSurface->pixels))[y + dx] = bColor;
+            if (dx < lpSurface->w)
+            {
+               ((LPBYTE)(lpSurface->pixels))[y + dx] = bColor;
+            }
+            else
+            {
+               break;
+            }
          }
          dx++;
       }