MediaInfoLib icon indicating copy to clipboard operation
MediaInfoLib copied to clipboard

mediainfo and libmediainfo throwing segmentation fault on files

Open juesor opened this issue 2 years ago • 15 comments

mediainfo-23.03-1.el7.x86_64 libmediainfo-23.03-1.el7.x86_64

On 10.4.2023 I upgraded to the above versions and ever since when I would do a check on an mkv file it would throw segmentation fault.

mediainfo -full MyFile.mkv Segmentation fault

Pulling that file down to my PC I can play just fine in VLC.

I had this installed via epel.

The fix for me was downloading the old RPM for both files.

libmediainfo-22.12-1.el7.x86_64.rpm mediainfo-22.12.x86_64.CentOS_7.rpm

And installing those directly.

Anything you can think of?

juesor avatar Apr 12 '23 20:04 juesor

This may have been fixed with another update, please test latest development snapshots.

JeromeMartinez avatar Apr 13 '23 12:04 JeromeMartinez

I started creating Alpine docker images (normally use ubuntu) using the community packaged mediainfo.
Last night I noticed that some files, e.g. VC1, WMV, cause a segmentation fault, while most others work fine.

E.g.

$ mediainfo --version
MediaInfo Command line,
MediaInfoLib - v23.03
~ $ mediainfo --Output=XML "/media/VC1 - foo.mkv"
Segmentation fault

Related, or different?

ptr727 avatar Apr 14 '23 14:04 ptr727

@ptr727 I think it is related, so dev snapshot or wait for next release in few weeks.

JeromeMartinez avatar Apr 14 '23 20:04 JeromeMartinez

Thank you.
I did not see Alpine binaries for the releases, is there a runtime compatible version I can try out on Alpine, or could you consider building for Alpine (very small docker images) ?

ptr727 avatar Apr 14 '23 23:04 ptr727

I did not see Alpine binaries for the releases,

We don't have Alpine binaries, you need to build from sources. If you have a compiler installed, it is just download e.g. this file and launch the script at the root directory.

JeromeMartinez avatar Apr 15 '23 13:04 JeromeMartinez

Ok thx, I'll give it a try.

ptr727 avatar Apr 15 '23 14:04 ptr727

If you have a compiler installed, it is just download e.g. this file and launch the script at the root directory.

Confirmed it works.

ptr727 avatar Apr 15 '23 18:04 ptr727

I can also confirm that the segfault is gone (tried on openSUSE Tumbleweed).

bugwelle avatar Apr 20 '23 17:04 bugwelle

Looks like a similar problem is back with v23.07 on Alpine, segfault.

ptr727 avatar Jul 20 '23 19:07 ptr727

@ptr727 no known issue if latest ZenLib is used. Does compiling e.g. from this dev snapshot fail too?

JeromeMartinez avatar Jul 21 '23 02:07 JeromeMartinez

I'll try it out, this crash is different, it segfaults on using just --version.

ptr727 avatar Jul 21 '23 02:07 ptr727

@JeromeMartinez Compiling from code works:

docker run -it --rm --pull always --name Testing mcr.microsoft.com/dotnet/sdk:7.0-alpine /bin/sh
apk update && apk add p7zip wget build-base
wget -O MediaInfo_CLI_GNU_FromSource.tar.bz2 https://mediaarea.net/download/snapshots/binary/mediainfo/20230715/MediaInfo_CLI_23.07.20230715_GNU_FromSource.tar.bz2
7z x -so MediaInfo_CLI_GNU_FromSource.tar.bz2 | tar xf -
cd MediaInfo_CLI_GNU_FromSource
./CLI_Compile.sh
./MediaInfo/Project/GNU/CLI/mediainfo --version
MediaInfo Command line,
MediaInfoLib - v23.07

ptr727 avatar Jul 21 '23 03:07 ptr727

SegFault repro:

docker run -it --rm --pull always --name Testing mcr.microsoft.com/dotnet/sdk:7.0-alpine /bin/sh

apk update
apk add mediainfo --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community/
mediainfo --version
Segmentation fault
apk add gdb
ldd /usr/bin/mediainfo
        /lib/ld-musl-x86_64.so.1 (0x7ffbb712c000)
        libmediainfo.so.0 => /usr/lib/libmediainfo.so.0 (0x7ffbb6a9d000)
        libzen.so.0 => /usr/lib/libzen.so.0 (0x7ffbb6a6b000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7ffbb681d000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7ffbb67ff000)
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7ffbb712c000)
        libcurl.so.4 => /usr/lib/libcurl.so.4 (0x7ffbb677a000)
        libtinyxml2.so.9 => /usr/lib/libtinyxml2.so.9 (0x7ffbb6765000)
        libz.so.1 => /lib/libz.so.1 (0x7ffbb674b000)
        libnghttp2.so.14 => /usr/lib/libnghttp2.so.14 (0x7ffbb6727000)
        libidn2.so.0 => /usr/lib/libidn2.so.0 (0x7ffbb66f5000)
        libssl.so.3 => /lib/libssl.so.3 (0x7ffbb666f000)
        libcrypto.so.3 => /lib/libcrypto.so.3 (0x7ffbb625c000)
        libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x7ffbb624e000)
        libunistring.so.5 => /usr/lib/libunistring.so.5 (0x7ffbb60a8000)
        libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x7ffbb6085000)
/ # gdb /usr/bin/mediainfo
GNU gdb (GDB) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-alpine-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/mediainfo...
(No debugging symbols found in /usr/bin/mediainfo)
(gdb) run --version
Starting program: /usr/bin/mediainfo --version
warning: Error disabling address space randomization: Operation not permitted

Program received signal SIGSEGV, Segmentation fault.
0x00007f5ad82a011a in std::basic_ostream<char, std::char_traits<char> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) () from /usr/lib/libstdc++.so.6

ptr727 avatar Jul 21 '23 04:07 ptr727

An update and closing out; installing mediainfo from Alpine Edge repo on Alpine 3.18 results in a segfault, looks like a C++ library mismatch of some kind, installing from latest-stable on 3.18 works, but is then out of date.

A statically linked version on Alpine may have greater compatibility, and / or making sure that all binary interfaces remain library version compatible.

ptr727 avatar Sep 20 '23 03:09 ptr727

Segfault is back in 23.07 on Alpine :( https://pkgs.alpinelinux.org/package/v3.18/community/x86_64/mediainfo

Update:
And same issue as before, mismatch in .NET MCR image Alpine versions and package, pinning versions resolves issue.
A statically linked version of mediainfo on Alpine could prevent issues like this.

ptr727 avatar Dec 08 '23 18:12 ptr727