Fl_Text_Buffer::replace() now range checks its input (STR #385)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3436 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2004-06-01 20:33:26 +00:00
parent c3fea65696
commit eeef51de66
2 changed files with 11 additions and 2 deletions

View File

@ -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)

View File

@ -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 $".
//