Manuel Bertsch
2023-Jun-29 20:28 UTC
[flac-dev] Disable all checksum verification in flac/metaflac
Hello all, I?m trying to use flac and metaflac as tooling to analyze the generated FLAC files of a new encoder implementation. However, while my own third-party decoder can handle the output just fine, flac, metaflac, and other tools discard the output since the frame checksum (footer CRC-16) is invalid. This is expected, since I have no checksum generation implemented apart from the frame header checksum (all other checksums are written as 0), but it prevents me from making development process without being able to check my outputs against the reference implementation. I looked around and I couldn?t find a way to turn off either tool?s checksum verification. So I?d like to know how one could turn off checksum verification in the tools, and if that?s not currently possible, I?d like to see that as a feature in a future version of flac. (In that case I would also try to disable the checks in code permanently, though my solution is most likely not going to be upstreamable in any capacity.) FYI, the third-party decoder is highly compliant according to the spec test suite, producing identical audio playback on almost all of the files, but it also doesn?t verify or error on any checksums. ffplay and ffmpeg both accept the file and can play and transcode it correctly, although they ignore the sample count in the streaminfo header and will read all frames they can find. The latter leads me to believe that checksums are the actual issue, even though flac reports the generic ?Bad Header? and ?Lost Sync?. Greetings and thanks in advance, Kleines Filmr?llchen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/flac-dev/attachments/20230629/80f22b3c/attachment.htm>
Martijn van Beurden
2023-Jun-30 05:22 UTC
[flac-dev] Disable all checksum verification in flac/metaflac
Hi, Is it possible for you to compile flac/metaflac yourself? Then you'll only need to remove a few lines, namely these 4: https://github.com/xiph/flac/blob/28e4f0528c76b296c561e922ba67d43751990599/src/libFLAC/stream_decoder.c#L2118-L2121 and these 7: https://github.com/xiph/flac/blob/28e4f0528c76b296c561e922ba67d43751990599/src/libFLAC/stream_decoder.c#L2141-L2147 As you can see these lines are also disabled on fuzzing. I think providing an API function and flac+metaflac command line option is going to be confusing and they will probably be misused. A compile time option might be possible though, libogg provides that too. Kind regards, Martijn van Beurden Op do 29 jun. 2023 22:28 schreef Manuel Bertsch <malu.bertsch at gmail.com>:> Hello all, > > > > I?m trying to use flac and metaflac as tooling to analyze the generated > FLAC files of a new encoder implementation. However, while my own > third-party decoder can handle the output just fine, flac, metaflac, and > other tools discard the output since the frame checksum (footer CRC-16) is > invalid. This is expected, since I have no checksum generation implemented > apart from the frame header checksum (all other checksums are written as > 0), but it prevents me from making development process without being able > to check my outputs against the reference implementation. I looked around > and I couldn?t find a way to turn off either tool?s checksum verification. > So I?d like to know how one could turn off checksum verification in the > tools, and if that?s not currently possible, I?d like to see that as a > feature in a future version of flac. (In that case I would also try to > disable the checks in code permanently, though my solution is most likely > not going to be upstreamable in any capacity.) > > > > FYI, the third-party decoder is highly compliant according to the spec > test suite, producing identical audio playback on almost all of the files, > but it also doesn?t verify or error on any checksums. ffplay and ffmpeg > both accept the file and can play and transcode it correctly, although they > ignore the sample count in the streaminfo header and will read all frames > they can find. The latter leads me to believe that checksums are the actual > issue, even though flac reports the generic ?Bad Header? and ?Lost Sync?. > > > > Greetings and thanks in advance, > > > > Kleines Filmr?llchen > _______________________________________________ > flac-dev mailing list > flac-dev at xiph.org > http://lists.xiph.org/mailman/listinfo/flac-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/flac-dev/attachments/20230630/404391dc/attachment.htm>