/dev/urandom's dev site

Crash-causing bug in VLC for Android

So I got a new tablet and as I was setting things up on it, I noticed that VLC kept crashing upon trying to parse my audio files. Android’s logcat gave me the following lines:

10-01 17:49:23.228  3650  3685 E VLC-std : libc++abi: terminating due to uncaught exception of type std::invalid_argument: stoi: no conversion
10-01 17:49:23.228  3650  3711 E libc++abi: terminating due to uncaught exception of type std::invalid_argument: stoi: no conversion
--------- beginning of crash
10-01 17:49:23.228  3650  3711 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 3711 (DefaultDispatch), pid 3650 (main)

with the following backtrace:

10-01 17:49:23.407  3797  3797 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-01 17:49:23.407  3797  3797 F DEBUG   : Build fingerprint: 'Lenovo/TB320FC_PRC/TB320FC:15/AQ3A.240812.002/ZUXOS_1.1.350_250418_PRC:user/release-keys'
10-01 17:49:23.407  3797  3797 F DEBUG   : Revision: '0'
10-01 17:49:23.407  3797  3797 F DEBUG   : ABI: 'arm64'
10-01 17:49:23.407  3797  3797 F DEBUG   : Timestamp: 2026-10-01 17:49:23.297636856+0300
10-01 17:49:23.407  3797  3797 F DEBUG   : Process uptime: 2s
10-01 17:49:23.407  3797  3797 F DEBUG   : Cmdline: org.videolan.vlc
10-01 17:49:23.407  3797  3797 F DEBUG   : pid: 3650, tid: 3711, name: DefaultDispatch  >>> org.videolan.vlc <<<
10-01 17:49:23.407  3797  3797 F DEBUG   : uid: 10302
10-01 17:49:23.407  3797  3797 F DEBUG   : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
10-01 17:49:23.407  3797  3797 F DEBUG   : pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
10-01 17:49:23.407  3797  3797 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
10-01 17:49:23.407  3797  3797 F DEBUG   : Abort message: 'terminating due to uncaught exception of type std::invalid_argument: stoi: no conversion'
10-01 17:49:23.407  3797  3797 F DEBUG   :     x0  0000000000000000  x1  0000000000000e7f  x2  0000000000000006  x3  0000006eedd4edc0
10-01 17:49:23.407  3797  3797 F DEBUG   :     x4  646277641f736766  x5  646277641f736766  x6  646277641f736766  x7  7f7f7f7f7f7f7f7f
10-01 17:49:23.407  3797  3797 F DEBUG   :     x8  00000000000000f0  x9  00000072be0aa3e8  x10 ffffff80fffffb9f  x11 0000000000000000
10-01 17:49:23.407  3797  3797 F DEBUG   :     x12 00000072e842b020  x13 000000007fffffff  x14 0000000002f6eeba  x15 000002e0dc30032d
10-01 17:49:23.407  3797  3797 F DEBUG   :     x16 00000072be15bfe0  x17 00000072be147b00  x18 0000006eed084000  x19 0000000000000e42
10-01 17:49:23.407  3797  3797 F DEBUG   :     x20 0000000000000e7f  x21 00000000ffffffff  x22 0000006eedd4eef0  x23 0000006eedd4ef30
10-01 17:49:23.407  3797  3797 F DEBUG   :     x24 0000006eedd4efe0  x25 b40000719faa6488  x26 0000006eedd4f370  x27 b4000071afae38e8
10-01 17:49:23.407  3797  3797 F DEBUG   :     x28 b4000071afae38e8  x29 0000006eedd4ee40
10-01 17:49:23.407  3797  3797 F DEBUG   :     lr  00000072be0e38e8  sp  0000006eedd4eda0  pc  00000072be0e3918  pst 0000000000001000
10-01 17:49:23.407  3797  3797 F DEBUG   : 17 total frames
10-01 17:49:23.407  3797  3797 F DEBUG   : backtrace:
10-01 17:49:23.407  3797  3797 F DEBUG   :       #00 pc 000000000005c918  /apex/com.android.runtime/lib64/bionic/libc.so (abort+172) (BuildId: 64eb5106bc8ae51d575bce9d5c64cec5)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #01 pc 000000000009ddec  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libc++_shared.so (BuildId: 7befe631535aa853c4f4ac1293e49dcea34c9b6e)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #02 pc 000000000009caa0  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libc++_shared.so (BuildId: 7befe631535aa853c4f4ac1293e49dcea34c9b6e)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #03 pc 000000000009cf78  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libc++_shared.so (BuildId: 7befe631535aa853c4f4ac1293e49dcea34c9b6e)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #04 pc 00000000000b8104  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libc++_shared.so (BuildId: 7befe631535aa853c4f4ac1293e49dcea34c9b6e)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #05 pc 00000000000b80e0  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libc++_shared.so (__cxa_throw+88) (BuildId: 7befe631535aa853c4f4ac1293e49dcea34c9b6e)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #06 pc 00000000000d8d2c  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libc++_shared.so (BuildId: 7befe631535aa853c4f4ac1293e49dcea34c9b6e)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #07 pc 00000000000d8cd8  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libc++_shared.so (BuildId: 7befe631535aa853c4f4ac1293e49dcea34c9b6e)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #08 pc 00000000000d57bc  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libc++_shared.so (std::__ndk1::stoi(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, unsigned long*, int)+248) (BuildId: 7befe631535aa853c4f4ac1293e49dcea34c9b6e)
  10-01 17:49:23.407  3797  3797 F DEBUG   :       #09 pc 0000000000302c70  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libmla.so (medialibrary::parser::MetadataAnalyzer::toInt(medialibrary::parser::IItem&, medialibrary::parser::IItem::Metadata)+72) (BuildId: b9e58dc73d0f0d473cadca39d89386f82743b76a)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #10 pc 000000000030bad4  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libmla.so (medialibrary::parser::MetadataAnalyzer::handleTrack(medialibrary::Album&, medialibrary::parser::IItem&, long, medialibrary::Genre*) const+96) (BuildId: b9e58dc73d0f0d473cadca39d89386f82743b76a)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #11 pc 00000000003065e0  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libmla.so (medialibrary::parser::MetadataAnalyzer::parseAudioFile(medialibrary::parser::IItem&, medialibrary::parser::MetadataAnalyzer::Cache&)+640) (BuildId: b9e58dc73d0f0d473cadca39d89386f82743b76a)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #12 pc 0000000000303424  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libmla.so (medialibrary::parser::MetadataAnalyzer::run(medialibrary::parser::IItem&)+1716) (BuildId: b9e58dc73d0f0d473cadca39d89386f82743b76a)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #13 pc 000000000031cb2c  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libmla.so (medialibrary::parser::Worker::mainloop()+2276) (BuildId: b9e58dc73d0f0d473cadca39d89386f82743b76a)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #14 pc 000000000031db2c  /data/app/~~4Jyh9iZrFY5wDY1KB6sy3w==/org.videolan.vlc-a6PpXebAOtf9cKIUiS82-w==/lib/arm64/libmla.so (BuildId: b9e58dc73d0f0d473cadca39d89386f82743b76a)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #15 pc 000000000006d8d0  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+196) (BuildId: 64eb5106bc8ae51d575bce9d5c64cec5)
10-01 17:49:23.407  3797  3797 F DEBUG   :       #16 pc 000000000005fd34  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: 64eb5106bc8ae51d575bce9d5c64cec5)

By experimenting with which files caused the crash and which tags in those files did that, I noticed that it happens when a file has a valid “Album” and “Track Number” tags, but its “Disc Number” tag happens to not be a number (say, the tagger accidentally wrote the disc’s serial number into it instead of what it’s supposed to contain – a number specifying which disc of many it is in a multi-disc collection).

Here is a FLAC file that demonstrates the bug. It plays fine in audio players (it’s just a sine wave lasting 5 seconds), but crashes VLC when it’s part of the music library.

If you’re concerned that the file might be unsafe (it does crash VLC, after all), you can create it by yourself independently using Audacity and MusicBrainz Picard:

  • Create a simple sound file, could consist of a few seconds of white noise or a sine wave,
  • Export it as a FLAC,
  • Open it in Picard,
  • Add basic “artist” and “album” tags with whichever contents you want (so it registers as a ), a “track number” that’s a valid number and a “disc number” that is NOT (such as a string of text),
  • Save the tags into that FLAC file.

When loading the media library with this file, VLC should crash. Upon next start-up, it will continue parsing the rest of the library, but skip that particular file. If there happen to be many of files with improper tags, VLC will crash repeatedly, until all of them are skipped.

More curiously, I investigated the backtrace and saw that, while it reports an uncaught std::invalid_argument exception in the medialibrary::parser::MetadataAnalyzer::toInt(medialibrary::parser::IItem&, medialibrary::parser::IItem::Metadata) function, the actual function in the source code of the library used by VLC clearly catches all std::logic_error exceptions, of which std::invalid_argument is a derived class.

Sadly, I’m unable to report this bug directly to VideoLAN’s issue tracker, as it requires users to provide a first and last name.

Visual style:
Color scheme: