On 1/4/2021 3:11 PM, AlexisWilke wrote:
It looks like the if() and the following lines disagree on the pointer to
be used.

I would imagine that these have been tested so the:

     f = indev_list[i - size];

and

     f = outdev_list[i - size];

are most certainly right, meaning that what's is wrong would be the condition
on the line prior. There is another location in that same file where a
similar test is used and the if() & following access use the same
pointer.

A proper test should call avpriv_register_devices() four times: with both
pointers set to NULL, both pointers not set to NULL, and twice with one of
the pointers set to NULL. That would allow you to verify this fix properly.

avpriv_register_devices() is an internal function that's called only once by avdevice_register_all(), and it will set both pointers to an array containing zero or more devices. Nothing else is meant to call it at all. So indev_list and outdev_list will either both be NULL, or point to separate device list arrays.

This means there's no chance for a crash, but i agree that to make this more robust, the list checked should be the one that's used afterwards, in case the above were to be changed.



AlexisWilke (1):
   bug: test pointer to be used.

  libavformat/allformats.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to