Fixed SDL_audiotypecvt.c

Please accept this fixed SDL_audiotypecvt.c. Without these fixes I’m
still getting crashes trying to load a 48KHz sound. Ryan fixed most
of these array out of bounds bugs a while back, so I just fixed the
rest of them here.–
Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL_audiotypecvt.c.gz
Type: application/x-gzip
Size: 25784 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100913/474bbbdc/attachment.bin

This file is generated by sdlgenaudiocvt.pl

2010/9/14, Terry Welsh :> Please accept this fixed SDL_audiotypecvt.c. Without these fixes I’m

still getting crashes trying to load a 48KHz sound. Ryan fixed most
of these array out of bounds bugs a while back, so I just fixed the
rest of them here.

Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com

Arg. It couldn’t have been that easy :stuck_out_tongue: Well, the necessary changes
to sdlgenaudiocvt.pl are much smaller. Here’s a diff:

@@ -400,15 +400,19 @@ static void SDLCALL
register int eps = 0;
EOF

  • my $endcomparison = ‘!=’;+

    Upsampling (growing the buffer) needs to work backwards, since we

    overwrite the buffer as we go.

    if ($upsample) {

  •    $endcomparison = '>';  # dst > target
       print <<EOF;
    

    $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels;
    const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
    const $fctype *target = ((const $fctype *) cvt->buf) - $channels;
    EOF
    } else {

  •    $endcomparison = '<';  # dst < target
       print <<EOF;
    

    $fctype *dst = ($fctype *) cvt->buf;
    const $fctype *src = ($fctype *) cvt->buf;
    @@ -432,7 +436,7 @@ EOF
    }

    print <<EOF;

  • while (dst != target) {
  • while (dst $endcomparison target) {
    EOF

    if ($upsample) {

Message: 1
Date: Tue, 14 Sep 2010 12:01:09 +0900
From: “Andrey A.”
To: SDL Development List
Subject: Re: [SDL] fixed SDL_audiotypecvt.c
Message-ID:
<AANLkTi=GhWUH+T40+hO+FD5Ujo99Jm6N4E2Ykqbon_TL at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

This file is generated by sdlgenaudiocvt.pl

2010/9/14, Terry Welsh <@Terry_Welsh>:

Please accept this fixed SDL_audiotypecvt.c. Without these fixes I’m
still getting crashes trying to load a 48KHz sound. Ryan fixed most
of these array out of bounds bugs a while back, so I just fixed the
rest of them here.

Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com

Thanks!

Do you give me permission to release your code with SDL 1.3 and future
versions of SDL under both the LGPL and a closed-source commercial
license?On Mon, Sep 13, 2010 at 6:55 PM, Terry Welsh wrote:

Please accept this fixed SDL_audiotypecvt.c. ?Without these fixes I’m
still getting crashes trying to load a 48KHz sound. ?Ryan fixed most
of these array out of bounds bugs a while back, so I just fixed the
rest of them here.

Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


? ? -Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Message: 4
Message-ID:
? ? ? ?<AANLkTimYqUPXzLc-+__pEGoe+OHBrQ=Fd+KRtg2bzbwn at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Thanks!

Do you give me permission to release your code with SDL 1.3 and future
versions of SDL under both the LGPL and a closed-source commercial
license?

Yes.> Date: Sat, 18 Sep 2010 18:16:21 -0700

From: Sam Lantinga
To: SDL Development List
Subject: Re: [SDL] fixed SDL_audiotypecvt.c

On Mon, Sep 13, 2010 at 6:55 PM, Terry Welsh <@Terry_Welsh> wrote:

Please accept this fixed SDL_audiotypecvt.c. ?Without these fixes I’m
still getting crashes trying to load a 48KHz sound. ?Ryan fixed most
of these array out of bounds bugs a while back, so I just fixed the
rest of them here.

Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com

Thanks! :)On Mon, Sep 20, 2010 at 8:35 AM, Terry Welsh wrote:

Message: 4
Date: Sat, 18 Sep 2010 18:16:21 -0700
From: Sam Lantinga <@slouken>
To: SDL Development List
Subject: Re: [SDL] fixed SDL_audiotypecvt.c
Message-ID:
? ? ? ?<AANLkTimYqUPXzLc-+__pEGoe+OHBrQ=Fd+KRtg2bzbwn at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Thanks!

Do you give me permission to release your code with SDL 1.3 and future
versions of SDL under both the LGPL and a closed-source commercial
license?

Yes.

On Mon, Sep 13, 2010 at 6:55 PM, Terry Welsh wrote:

Please accept this fixed SDL_audiotypecvt.c. ?Without these fixes I’m
still getting crashes trying to load a 48KHz sound. ?Ryan fixed most
of these array out of bounds bugs a while back, so I just fixed the
rest of them here.

Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


? ? -Sam Lantinga, Founder and President, Galaxy Gameworks LLC