[FFmpeg-devel] [PATCH 1/4] Use appropriate method for device discovery, fix crash with bogus device index.

Thilo Borgmann thilo.borgmann at mail.de
Mon Jan 31 12:10:57 EET 2022


Hi,

Am 30.01.22 um 18:30 schrieb toots at rastageeks.org:
> From: Romain Beauxis <toots at rastageeks.org>
> 
> This updates the code for avfoundation to use modern device lookup APIs and also adds a check to avoid querying the video devices array beyound its maximum size.
> 
> ---
>   libavdevice/avfoundation.m | 71 ++++++++++++++++++++++++++++++--------
>   1 file changed, 56 insertions(+), 15 deletions(-)
> 
> diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
> index 0cd6e646d5..d8bcd98f81 100644
> --- a/libavdevice/avfoundation.m
> +++ b/libavdevice/avfoundation.m
> @@ -27,6 +27,7 @@
>   
>   #import <AVFoundation/AVFoundation.h>
>   #include <pthread.h>
> +#include <Availability.h>
>   
>   #include "libavutil/channel_layout.h"
>   #include "libavutil/pixdesc.h"
> @@ -764,8 +765,34 @@ static int avf_read_header(AVFormatContext *s)
[...]

the patch doesn't appear to be broken any more, though it does not apply to current HEAD

Thilos-Mac-mini:FFmpeg borgmann$ git apply ../patches/avfoundation/\[PATCH\ 1_4\]\ Use\ appropriate\ method\ for\ device\ discovery\,\ fix\ crash\ with\ bogus\ device\ index.\ -\ toots\@rastageeks.org\ -\ 2022-01-30\ 1830.eml
error: patch failed: libavdevice/avfoundation.m:27
error: libavdevice/avfoundation.m: patch does not apply

I don't see why it does not apply as the part around line 27 looks sane. Did you try to apply to HEAD?

-Thilo


More information about the ffmpeg-devel mailing list