Patches item #3534117, was opened at 2012-06-10 03:50 Message generated for change (Comment added) made by eric_wong You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=310706&aid=3534117&group_id=10706
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: eric_wong (eric_wong) Assigned to: Nobody/Anonymous (nobody) Summary: flac (decoder): simplify EOF state and fix MD5 check Initial Comment: This patch depends on commit e9a8dcf780f1cbb6a6faf63b7ba28591963c1cbd (flac: fix invalid memory access w/ optimize_trim) in the "dot" branch. This patch is also available from my git repo: git pull git://bogomips.org/sox dot-flac-eof-md5 There's no need to keep track of EOF state ourselves as the FLAC decoder already keeps track of decoder state us. Instead, we only need to keep track of whether or not we've seeked for MD5 verification. To test the ability of the flac handler to detect bad MD5s, I changed the MD5 checksum of a good FLAC file using the undocumented "--set-md5sum" option of metaflac(1): metaflac --set-md5sum d41d8cd98f00b204e9800998ecf8427e foo.flac This let me decode the entire file without errors, but ultimately fail the MD5 check. ---------------------------------------------------------------------- >Comment By: eric_wong (eric_wong) Date: 2012-06-10 11:38 Message: My original patch failed to take into account skipping tracks and incorrectly warned about MD5 mismatches when hitting Ctrl-C in play. I've squashed the following change into my original patch and repushed to "dot-flac-eof-md5" of git://bogomips.org/sox The current commit should be 1dedd809d7e095a3398181e25d235573961e20e8 --- a/src/flac.c +++ b/src/flac.c @@ -275,7 +275,7 @@ static size_t read_samples(sox_format_t * const ft, sox_sample_t * sampleBuffer, static int stop_read(sox_format_t * const ft) { priv_t * p = (priv_t *)ft->priv; - if (!FLAC__stream_decoder_finish(p->decoder) && ! p->seek_done) + if (!FLAC__stream_decoder_finish(p->decoder) && ! p->seek_done && FLAC__stream_decoder_get_state(p->decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) lsx_warn("decoder MD5 checksum mismatch."); FLAC__stream_decoder_delete(p->decoder); ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=310706&aid=3534117&group_id=10706 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ SoX-devel mailing list SoX-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-devel