Re: "Perfect" MP3 fails to import

"Leland" <[email protected]> Thu, 15 Apr 2021 11:27:23 -0500
Newsgroups gmane.comp.audio.audacity.devel
Message-ID <[email protected]>
Gave it a try butit still throws the Huffman error.

 

From: James Crook <[email protected]> 
Sent: Thursday, April 15, 2021 10:52 AM
To: audacity-devel <[email protected]>
Subject: Re: [Audacity-devel] "Perfect" MP3 fails to import

 

With that mp3 file we reach this point in layer3.c, with cachesz == 20 and bits_left == -22

  if (cachesz + bits_left < 0)
    return MAD_ERROR_BADHUFFDATA;  /* big_values overrun */


There's a patch here that addresses length issues and changes that code:
https://fossies.org/linux/avidemux/avidemux_plugins/ADM_audioDecoders/ADM_ad_mad/patches/length-check.patch

 
  635 +     if (cachesz - fakebits < 1)
  636 +       return MAD_ERROR_BADHUFFDATA;
  637       xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
  638         -requantized : requantized;
  639     }
  640 @@ -1155,9 +1221,6 @@ enum mad_error III_huffdecode(struct mad
  641      }
  642    }
  643  
  644 -  if (cachesz + bits_left < 0)
  645 -    return MAD_ERROR_BADHUFFDATA;  /* big_values overrun */
  646 -
  647

 

The patch looks pretty extensive.

 

    From: Kurt Roeckx <[email protected] <mailto:[email protected]> >
    Date: Sun, 28 Jan 2018 19:26:36 +0100
    Subject: Check the size before reading with mad_bit_read


    There are various cases where it attempts to read past the end of the buffer
    using mad_bit_read(). Most functions didn't even know the size of the buffer
    they were reading from.

We are using libmad 0.15.1b.
Debian have  0.15.2b-9 with these fixes from 2018 in.

This would need careful review.  Probably worth contacting Kurt Roeckx too, to confirm we're understanding things correctly, and say thank you.

 

--James.



 

 

On Thu, 15 Apr 2021 at 15:48, Steve Fiddle <[email protected] <mailto:[email protected]> > wrote:

 

 

On Thu, 15 Apr 2021 at 15:41, James Crook <[email protected] <mailto:[email protected]> > wrote:

Your first message never made it to this list (I just checked the archive).
What's the link for the mp3?

 

You can get it here: https://drive.google.com/file/d/1qCPXtsBfFII2NwsSVMZY9k-Lx6sbhlS8/view?usp=sharing

 

Steve

 

 

On Thu, 15 Apr 2021 at 15:35, Steve Fiddle <[email protected] <mailto:[email protected]> > wrote:

Good detective work James.

 

Any ideas about the MP3 file (first post of this thread)? Given your explanation of the OGG problem, I assume that it is a different issue.

 

I'm thinking that it is probably an Audacity bug because the file appears to be a valid MP3 file. On the other hand, if the MP3 is malformed (in some way that I've not been able to detect), then it's rather more open to opinion whether or not it is an Audacity bug, or a bug in the application that created it.

 

Steve

 

On Thu, 15 Apr 2021 at 13:43, James Crook <[email protected] <mailto:[email protected]> > wrote:

Logged as: https://bugzilla.audacityteam.org/show_bug.cgi?id=2748

 

On Thu, 15 Apr 2021 at 13:27, James Crook <[email protected] <mailto:[email protected]> > wrote:

It's the same infinite loop as JUCE had:

https://forum.juce.com/t/ogg-vorbis-file-puts-juce-oggreader-in-infinite-loop/41148

So will be fixed if we upgrade to 1.3.7 or later.

 

On Thu, 15 Apr 2021 at 13:00, James Crook <[email protected] <mailto:[email protected]> > wrote:

On both 3.0.2 and 2.4.2 it's stuck in library file, vorbisfile.c

static int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence){
  if(f==NULL)return(-1);
  return fseek(f,off,whence);
}

'off' and 'whence' are both zero ( SEEK_SET ==0, SEEK_CUR==1, SEEK_END==2).  We're compiled 32 bit on windows.  Anyone know if it hangs on mac/linux (compiled 64 bit) too?

 

--James.

 

On Thu, 15 Apr 2021 at 12:31, James Crook <[email protected] <mailto:[email protected]> > wrote:

Confirmed freezes for me on Windows.

 

On Thu, 15 Apr 2021 at 12:20, Steve Fiddle <[email protected] <mailto:[email protected]> > wrote:

And by "coincidence" (?), a problem reported importing this ogg file:

https://upload.wikimedia.org/wikipedia/commons/0/0f/Claude_Debussy_-_Premi%C3%A8re_Arabesque_-_Patrizia_Prati.ogg

 

As with the MP3 file, it can be imported if you select the "FFmpeg-compatible files" filter, but in this case, using Audacity's native OGG importer causes Audacity to freeze on both Windows and Linux (not tested on macOS).

 

I don't like coincidences as they may be indicating a deeper problem.

 

Steve

 

On Thu, 15 Apr 2021 at 12:01, Steve Fiddle <[email protected] <mailto:[email protected]> > wrote:

I've tested the attached file with multiple tools in Linux and it appears to be perfectly formed, yet Audacity still complains that it is malformed and refuses to import it.

 

Steve

_______________________________________________
audacity-devel mailing list
[email protected] <mailto:[email protected]> 
https://lists.sourceforge.net/lists/listinfo/audacity-devel

_______________________________________________
audacity-devel mailing list
[email protected] <mailto:[email protected]> 
https://lists.sourceforge.net/lists/listinfo/audacity-devel

_______________________________________________
audacity-devel mailing list
[email protected] <mailto:[email protected]> 
https://lists.sourceforge.net/lists/listinfo/audacity-devel

_______________________________________________
audacity-devel mailing list
[email protected] <mailto:[email protected]> 
https://lists.sourceforge.net/lists/listinfo/audacity-devel

_______________________________________________
audacity-devel mailing list
[email protected] <mailto:[email protected]> 
https://lists.sourceforge.net/lists/listinfo/audacity-devel

_______________________________________________
audacity-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-devel