[PATCH] Fix seabear import sample overrun bug
Dirk Hohndel
dirk at hohndel.org
Mon Apr 11 12:39:00 PDT 2016
Patches applied to master and v4.5-branch and pushed.
/D
On Mon, Apr 11, 2016 at 11:42:25AM -0700, Linus Torvalds wrote:
>
> From: Linus Torvalds <torvalds at linux-foundation.org>
> Date: Mon, 11 Apr 2016 11:36:31 -0700
> Subject: [PATCH] Fix seabear import sample overrun bug
>
> The Seabear import fixed up the NDL and TTS in the samples from minutes
> (in the import) to seconds (our internal format for all time). But it
> did it with a loop that overran the end of the samples array by one:
>
> for(int s_nr = 0 ; s_nr <= dive->dc.samples ; s_nr++) {
>
> Fix it to use the proper "<" instead of "<=".
>
> Reported-by: Stuart Vernon <stuartv at force2.net>
> Tested-by: Miika Turkia <miika.turkia at gmail.com>
> Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
> ---
>
> NOTE! This is the version that applies to the current development version
> of the tree. I'll send out another patch for the 4.5.5 tree asap.
>
> desktop-widgets/divelogimportdialog.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
> index cd9026f8786d..757cad59e98a 100644
> --- a/desktop-widgets/divelogimportdialog.cpp
> +++ b/desktop-widgets/divelogimportdialog.cpp
> @@ -782,7 +782,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
> }
> // Seabear CSV stores NDL and TTS in Minutes, not seconds
> struct dive *dive = dive_table.dives[dive_table.nr - 1];
> - for(int s_nr = 0 ; s_nr <= dive->dc.samples ; s_nr++) {
> + for(int s_nr = 0 ; s_nr < dive->dc.samples ; s_nr++) {
> struct sample *sample = dive->dc.sample + s_nr;
> sample->ndl.seconds *= 60;
> sample->tts.seconds *= 60;
> --
> 2.8.0.rc4.16.g56331f8
>
>
More information about the subsurface
mailing list