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

George Staikos staikos at kde.org
Fri Jan 27 22:10:04 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         




------- Additional Comments From staikos kde org  2006-01-27 22:09 -------
This patch looks correct.  Reviewed=me.  Leaving the asserts there will help 
us catch regressions later.

On Friday 27 January 2006 11:55, netterfield astro utoronto ca wrote:

> Index: kstrvector.cpp
> ===================================================================
> --- kstrvector.cpp      (revision 502941)
> +++ kstrvector.cpp      (working copy)
>  @ -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);
> _______________________________________________
> Kst mailing list
> Kst kde org
> https://mail.kde.org/mailman/listinfo/kst


More information about the Kst mailing list