summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2004-06-01 20:33:26 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2004-06-01 20:33:26 +0000
commiteeef51de66f1502969f8684b9c2ade55f668403d (patch)
tree9ec2f0b7dab9019b8e90e1c2fe0bdb99da747181 /src
parentc3fea65696c6ffdb9f9ae64ea3ed0c8322010bf5 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Text_Buffer.cxx11
1 files changed, 9 insertions, 2 deletions
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 $".
//