diff options
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | src/Fl_Text_Buffer.cxx | 11 |
2 files changed, 11 insertions, 2 deletions
@@ -1,6 +1,8 @@ CHANGES IN FLTK 1.1.5rc2 - Documentation updates (STR #365, STR #399) + - Fl_Text_Buffer::replace() now range checks its input + (STR #385) - FLTK now builds with the current release of MinGW (STR #325, STR #401, STR #402) - FLTK now honors the numlock key state (STR #369) diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx index 558ff7f7a..e5e4e17a0 100644 --- a/src/Fl_Text_Buffer.cxx +++ b/src/Fl_Text_Buffer.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.20 2004/04/11 04:38:58 easysw Exp $" +// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.21 2004/06/01 20:33:26 easysw Exp $" // // Copyright 2001-2004 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under @@ -268,6 +268,11 @@ void Fl_Text_Buffer::replace( int start, int end, const char *s ) { const char * deletedText; int nInserted; + // Range check... + if (!s) return; + if (start < 0) start = 0; + if (end > mLength) end = mLength; + call_predelete_callbacks( start, end-start ); deletedText = text_range( start, end ); remove_( start, end ); @@ -292,6 +297,8 @@ void Fl_Text_Buffer::remove( int start, int end ) { if ( end > mLength ) end = mLength; if ( end < 0 ) end = 0; + if (start == end) return; + call_predelete_callbacks( start, end-start ); /* Remove and redisplay */ deletedText = text_range( start, end ); @@ -2510,5 +2517,5 @@ Fl_Text_Buffer::outputfile(const char *file, int start, int end, int buflen) { // -// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.20 2004/04/11 04:38:58 easysw Exp $". +// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.21 2004/06/01 20:33:26 easysw Exp $". // |
