diff -r f28f7b0f72ae SDL_ttf.c --- a/SDL_ttf.c Sat Oct 04 11:55:45 2014 -0400 +++ b/SDL_ttf.c Fri Oct 10 03:10:31 2014 -0300 @@ -1440,6 +1440,9 @@ dst = (Uint8*) textbuf->pixels + (row+glyph->yoffset) * textbuf->pitch + xstart + glyph->minx; + if ( dst < (Uint8*) textbuf->pixels ) { + dst = textbuf->pixels; + } src = current->buffer + row * current->pitch; for ( col=width; col>0 && dst < dst_check; --col ) { @@ -1622,6 +1625,9 @@ dst = (Uint8*) textbuf->pixels + (row+glyph->yoffset) * textbuf->pitch + xstart + glyph->minx; + if ( dst < (Uint8*) textbuf->pixels ) { + dst = textbuf->pixels; + } src = current->buffer + row * current->pitch; for ( col=width; col>0 && dst < dst_check; --col ) { *dst++ |= *src++; @@ -1792,6 +1798,9 @@ dst = (Uint32*) textbuf->pixels + (row+glyph->yoffset) * textbuf->pitch/4 + xstart + glyph->minx; + if ( dst < (Uint32*) textbuf->pixels ) { + dst = textbuf->pixels; + } /* Added code to adjust src pointer for pixmaps to * account for pitch. @@ -2060,6 +2069,9 @@ dst = ((Uint32*)textbuf->pixels + rowSize * line) + (row+glyph->yoffset) * textbuf->pitch/4 + xstart + glyph->minx; + if ( dst < (Uint32*) textbuf->pixels ) { + dst = textbuf->pixels; + } /* Added code to adjust src pointer for pixmaps to * account for pitch.