Martchus / tageditor

A tag editor with Qt GUI and command-line interface supporting MP4/M4A/AAC (iTunes), ID3, Vorbis, Opus, FLAC and Matroska
GNU General Public License v2.0
692 stars 56 forks source link

Can't read FLAC tags #75

Closed FritzHeiden closed 3 years ago

FritzHeiden commented 3 years ago

I am really interested in the CLI of tageditor. I tried to read tags from several FLAC files and I get the following error:

$ tageditor get -f 01\ -\ Intro.flac
/usr/include/c++/11.1.0/string_view:234: constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; std::basic_string_view<_CharT, _Traits>::const_reference = const char&; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]: Assertion '__pos < this->_M_len' failed.
[1]    102164 abort (core dumped)  tageditor get -f 01\ -\ Intro.flac

Tried an OPUS file, which works just fine.

I am running Arch Linux 5.14.14-arch1-1, installed tageditor 3.5.1 using the AUR.

Martchus commented 3 years ago

I cannot reproduce the problem with one of my FLAC example files. Can you show me the stack trace? (coredumpctl should have it.) Maybe you could also provide me the sample file or e.g. an ffmpeg command to produce it.

FritzHeiden commented 3 years ago

How do I use coredumpctl? How should I provide you the file?

Martchus commented 3 years ago

You could just paste the stacktrace. coredumpctl --help shows you the commands available. Basically just do list to find the relevant coredump and then use info to get the stacktrace.

I've also just did find -iname '*.flac' -exec tageditor get -f {} \+ on my lossless music folder and didn't get a coredump.

You could upload the sample file somewhere, e.g. directly on GitHub. Possibly it makes sense to cut it down to the first few seconds, e.g. via ffmpeg (although the resulting file might not be able to reproduce the bug anymore - so check whether it still reproduced the bug).

FritzHeiden commented 3 years ago
           PID: 168584 (tageditor)
           UID: 1000 (fritz)
           GID: 1000 (fritz)
        Signal: 6 (ABRT)
     Timestamp: Tue 2021-10-26 14:49:24 CEST (1min 34s ago)
  Command Line: tageditor get -v -f $'01 - Intro.flac'
    Executable: /usr/bin/tageditor
 Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-53303583-dd23-460d-a2a1-4eef1e9baebf.scope
          Unit: user@1000.service
     User Unit: vte-spawn-53303583-dd23-460d-a2a1-4eef1e9baebf.scope
         Slice: user-1000.slice
     Owner UID: 1000 (fritz)
       Boot ID: e187445fb8674d2fa68fb18c92e261ae
    Machine ID: 62b5ef41468e4c8e9fd8e84d1a62ba2c
      Hostname: fritz-fokus-laptop
       Storage: /var/lib/systemd/coredump/core.tageditor.1000.e187445fb8674d2fa68fb18c92e261ae.168584.1635252564000000.zst (present)
     Disk Size: 72.1K
       Message: Process 168584 (tageditor) of user 1000 dumped core.

                Found module linux-vdso.so.1 with build-id: cc412381f6faf7735f689e78e2ede93a7a28733c
                Found module libm.so.6 with build-id: 2b8fd1f869ecab4e0b55e92f2f151897f6818acf
                Found module ld-linux-x86-64.so.2 with build-id: 040cc3dd10461562f177df39e3be2f3704258c3c
                Found module libz.so.1 with build-id: 81bf6e728a6d6f5b105b0f8b25f6c614ce10452a
                Found module libc.so.6 with build-id: 4b406737057708c0e4c642345a703c47a61c73dc
                Found module libgcc_s.so.1 with build-id: 7f8508bb914546ada778809b64b99d234337d835
                Found module libstdc++.so.6 with build-id: 8ab0e57054dd1dcba681f217016afc6a4e639783
                Found module libc++utilities.so.5 with build-id: 6f6f820116633c61c1ba4e0161d4c25f4d1b3f24
                Found module libtagparser.so.10 with build-id: 2a9e2b5ec0b4564c91e169355142d53a8f412051
                Found module tageditor with build-id: e5a5d41d14975e9df78fcbe18a54ca2c5ccf8754
                Stack trace of thread 168584:
                #0  0x00007fea6f1a8d22 raise (libc.so.6 + 0x3cd22)
                #1  0x00007fea6f192862 abort (libc.so.6 + 0x26862)
                #2  0x00007fea6f605543 _ZN9TagParser23FlacMetaDataBlockHeader11parseHeaderESt17basic_string_viewIcSt11char_traitsIcEE (libtagparser.so.10 + 0x5d543)
                #3  0x00007fea6f6062c4 _ZN9TagParser10FlacStream19internalParseHeaderERNS_11DiagnosticsERNS_25AbortableProgressFeedbackE (libtagparser.so.10 + 0x5e2c4)
                #4  0x00007fea6f5f81f5 _ZN9TagParser13AbstractTrack11parseHeaderERNS_11DiagnosticsERNS_25AbortableProgressFeedbackE (libtagparser.so.10 + 0x501f5)
                #5  0x00007fea6f68ef23 _ZN9TagParser13MediaFileInfo11parseTracksERNS_11DiagnosticsERNS_25AbortableProgressFeedbackE (libtagparser.so.10 + 0xe6f23)
                #6  0x00007fea6f68f760 _ZN9TagParser13MediaFileInfo9parseTagsERNS_11DiagnosticsERNS_25AbortableProgressFeedbackE (libtagparser.so.10 + 0xe7760)
                #7  0x000056547536a56e n/a (tageditor + 0x3256e)
                #8  0x00007fea6f57a6ce _ZN12CppUtilities14ArgumentParser15invokeCallbacksERKSt6vectorIPNS_8ArgumentESaIS3_EE (libc++utilities.so.5 + 0x116ce)
                #9  0x000056547534bdb2 n/a (tageditor + 0x13db2)
                #10 0x00007fea6f193b25 __libc_start_main (libc.so.6 + 0x27b25)
                #11 0x000056547534c08e _start (tageditor + 0x1408e)
FritzHeiden commented 3 years ago

Here the sliced FLAC file: slice_1.zip

Martchus commented 3 years ago

I found the problematic code. Unfortunately I still cannot reproduce it because that depends a little bit on (bad) luck. Thanks for reporting. I'll prepare a fix later. (Note that the problem is actually within tagparser.)

Martchus commented 3 years ago

The problem should be fixed on master (of tagparser). If you'd like to test it you can install tageditor-git (which will use tagparser-git). I'll also update the binary repository but the build is still pending on my server.

FritzHeiden commented 3 years ago

I am building master right now, will report when its done.

FritzHeiden commented 3 years ago

Problem fixed! Thanks a lot

Martchus commented 3 years ago

You're welcome :-)