[Kst] [Bug 120823] Crash if attempt to read past end of dirfile.

netterfield at astro.utoronto.ca netterfield at astro.utoronto.ca
Sat Jan 28 01:36:50 CET 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=120823         
netterfield astro utoronto ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From netterfield astro utoronto ca  2006-01-28 01:36 -------
SVN commit 503057 by netterfield:

BUG: 120823

Read past EOF results in a vector of 1 sample = NaN.



 M  +7 -2      kstrvector.cpp  


--- trunk/extragear/graphics/kst/kst/kstrvector.cpp #503056:503057
 @ -430,7 +430,8  @
   int i, k, shift, n_read=0;
   int ave_nread;
   int new_f0, new_nf;
-
+  bool start_past_eof = false;
+  
   checkIntegrity();
 
   if (DoSkip && Skip < 2 && SPF == 1) {
 @ -462,6 +463,7  @
       // Tried to read starting past the end.
       new_f0 = 0;
       new_nf = 1;
+      start_past_eof = true;
     }
   }
 
 @ -575,7 +577,10  @
     }
 
     // read the new data from file
-    if (_file->samplesPerFrame(_field) > 1) {
+    if (start_past_eof) {
+      _v[0] = NAN;
+      n_read = 1;
+    } else if (_file->samplesPerFrame(_field) > 1) {
       assert(new_nf - NF - 1 > 0 || new_nf - NF - 1 == -1);
       assert(new_f0 + NF >= 0);
       assert(new_f0 + new_nf - 1 >= 0);


More information about the Kst mailing list