From f61964ecbf440af33a9a6bc994c8b565e3157c1f Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Tue, 18 Oct 2022 03:05:06 +0000 Subject: multimedia/dav1d: work around crashes with clang >= 12 on i386 $ ffmpeg -hide_banner -i foo.y4m -c:v libsvtav1 -y foo.ivf $ ffmpeg -hide_banner -i foo.ivf -f null /dev/null [libdav1d @ 0x250c2c00] libdav1d 1.0.0 [libdav1d @ 0x250c2c00] Frame size limit reduced from 2147483647 to 67108864. Bus error * thread #1, name = 'ffmpeg', stop reason = signal SIGBUS: hardware error frame #0: 0x22e8c816 libdav1d.so.6`dav1d_data_wrap(buf=0x25100390, ptr="\U00000012", sz=61259, free_callback=(libavcodec.so.58`libdav1d_data_free at libdav1d.c:189), user_data=0x250d66c0) at lib.c:734 (lldb) bt * thread #1, name = 'ffmpeg', stop reason = signal SIGBUS: hardware error * frame #0: 0x22e8c816 libdav1d.so.6`dav1d_data_wrap(buf=0x25100390, ptr="\U00000012", sz=61259, free_callback=(libavcodec.so.58`libdav1d_data_free at libdav1d.c:189), user_data=0x250d66c0) at lib.c:734 frame #1: 0x213a4c33 libavcodec.so.58`libdav1d_receive_frame(c=, frame=) at libdav1d.c:215:19 frame #2: 0x21121082 libavcodec.so.58`decode_receive_frame_internal(avctx=0x250bfc00, frame=) at decode.c:546:15 frame #3: 0x21120fd8 libavcodec.so.58`avcodec_send_packet(avctx=0x250bfc00, avpkt=0xffffd3d0) at decode.c:617:15 frame #4: 0x20a5273d libavformat.so.58`try_decode_frame(s=, st=0x250f9000, avpkt=, options=) at utils.c:3084:19 frame #5: 0x20a4fe73 libavformat.so.58`avformat_find_stream_info(ic=0x250d7000, options=0x250d61c0) at utils.c:3949:9 frame #6: 0x00418cf6 ffmpeg`open_input_file(o=0xffffd80c, filename=) at ffmpeg_opt.c:1196:15 frame #7: 0x004184c9 ffmpeg`open_files(l=, inout=, open_file=) at ffmpeg_opt.c:3338:15 frame #8: 0x00418278 ffmpeg`ffmpeg_parse_options(argc=, argv=) at ffmpeg_opt.c:3378:11 frame #9: 0x0042e6f0 ffmpeg`main(argc=7, argv=0xffffdc44) at ffmpeg.c:4988:11 frame #10: 0x00417d0d ffmpeg`_start1(cleanup=0x204537e0, argc=7, argv=0xffffdc44) at crt1_c.c:72:7 frame #11: 0x00417e70 ffmpeg`_start at crt1_s.S:46 $ make clean test -C graphics/libavif [...] 45% tests passed, 6 tests failed out of 11 Total Test time (real) = 17.82 sec The following tests FAILED: 1 - aviftest (Bus error) 5 - avifchangesettingtest (Bus error) 6 - avifgridapitest (Bus error) 7 - avifincrtest (Bus error) 8 - avifmetadatatest (Bus error) 11 - test_cmd (Failed) * thread #1, name = 'aviftest', stop reason = signal SIGBUS: hardware error frame #0: 0x207a81f6 libdav1d.so.6`dav1d_data_wrap(buf=0xffffc7d4, ptr="\U00000012", sz=37169, free_callback=(libavif.so.15`avifDav1dFreeCallback at codec_dav1d.c:34), user_data=0x00000000) at lib.c:734 731 void (*const free_callback)(const uint8_t *data, 732 void *user_data), 733 void *const user_data) -> 734 { 735 return dav1d_data_wrap_internal(buf, ptr, sz, free_callback, user_data); 736 } 737 (lldb) bt * thread #1, name = 'aviftest', stop reason = signal SIGBUS: hardware error * frame #0: 0x207a81f6 libdav1d.so.6`dav1d_data_wrap(buf=0xffffc7d4, ptr="\U00000012", sz=37169, free_callback=(libavif.so.15`avifDav1dFreeCallback at codec_dav1d.c:34), user_data=0x00000000) at lib.c:734 frame #1: 0x204746a1 libavif.so.15`dav1dCodecGetNextImage(codec=0x215e9090, decoder=0x2182c000, sample=0x215e9060, alpha=0, isLimitedRangeAlpha=0xffffc93c, image=0x218400a0) at codec_dav1d.c:87:9 frame #2: 0x2045c812 libavif.so.15`avifDecoderDecodeTiles(decoder=0x2182c000, nextImageIndex=0, firstTileIndex=0, tileCount=1, decodedTileCount=0x2183302c) at read.c:3853:14 frame #3: 0x2045bf59 libavif.so.15`avifDecoderNextImage(decoder=0x2182c000) at read.c:3937:9 frame #4: 0x004029a9 aviftest`runIOTests(dataDir="../libavif-0.11.0/tests/data/") at aviftest.c:255:54 frame #5: 0x00402310 aviftest`main(argc=2, argv=0xffffdc0c) at aviftest.c:327:19 frame #6: 0x00401f9d aviftest`_start1(cleanup=0x204157e0, argc=2, argv=0xffffdc0c) at crt1_c.c:72:7 frame #7: 0x00402100 aviftest`_start at crt1_s.S:46 --- multimedia/dav1d/Makefile | 2 +- multimedia/dav1d/files/patch-i386 | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 multimedia/dav1d/files/patch-i386 diff --git a/multimedia/dav1d/Makefile b/multimedia/dav1d/Makefile index 97553bc2f3b6..e308928b3e43 100644 --- a/multimedia/dav1d/Makefile +++ b/multimedia/dav1d/Makefile @@ -1,6 +1,6 @@ PORTNAME= dav1d DISTVERSION= 1.0.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= multimedia MAINTAINER= jbeich@FreeBSD.org diff --git a/multimedia/dav1d/files/patch-i386 b/multimedia/dav1d/files/patch-i386 new file mode 100644 index 000000000000..a6d2e328e3cc --- /dev/null +++ b/multimedia/dav1d/files/patch-i386 @@ -0,0 +1,14 @@ +https://code.videolan.org/videolan/dav1d/-/issues/408 + +--- src/lib.c.orig 2022-03-18 13:31:21 UTC ++++ src/lib.c +@@ -726,6 +726,9 @@ uint8_t *dav1d_data_create(Dav1dData *const buf, const + return dav1d_data_create_internal(buf, sz); + } + ++#ifdef __i386__ ++__attribute__((optnone)) ++#endif + int dav1d_data_wrap(Dav1dData *const buf, const uint8_t *const ptr, + const size_t sz, + void (*const free_callback)(const uint8_t *data, -- cgit v1.2.3