From a11a31ff78af62e73735b5e012849523a612e26a Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 5 Aug 2002 17:50:25 +0000 Subject: Range check Fl_Text_Buffer::search_forward(). Don't use png_read_destroy() - it doesn't free all memory. Add uncache() method to image classes. Memory/initialization bugs in Fl_File_Chooser (valgrind) Make sure both Fl_Window constructors have default cursor initialization code... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2562 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Text_Buffer.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Fl_Text_Buffer.cxx') diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx index 5b65f82b3..d1707a98f 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.8 2002/06/10 21:04:19 easysw Exp $" +// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.9 2002/08/05 17:50:25 easysw Exp $" // // Copyright 2001-2002 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under @@ -1967,6 +1967,11 @@ int Fl_Text_Buffer::findchar_forward( int startPos, char searchChar, int *foundPos ) { int pos, gapLen = mGapEnd - mGapStart; + if (pos < 0 || pos >= mLength) { + *foundPos = mLength; + return 0; + } + pos = startPos; while ( pos < mGapStart ) { if ( mBuf[ pos ] == searchChar ) { @@ -2284,5 +2289,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.8 2002/06/10 21:04:19 easysw Exp $". +// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.9 2002/08/05 17:50:25 easysw Exp $". // -- cgit v1.2.3