Commit Graph

8 Commits

Author SHA1 Message Date
Andreas Rheinhardt e07541930a avfilter/vf_signature: Avoid cast from function pointer to void*
The signature filter uses qsort, but its compare function doesn't have
the signature required of such a function; therefore it casts the
function pointer to void. Yet this is wrong:
C90 only guarantees that one can convert a pointer to any incomplete
type or object type to void* and back with the result comparing equal
to the original which makes pointers to void generic pointers to
incomplete or object type. Yet C90 lacks a generic function pointer
type.
C99 additionally guarantees that a pointer to a function of one type may
be converted to a pointer to a function of another type with the result
and the original comparing equal when converting back.
This makes any function pointer type a generic function pointer type.
Yet even this does not make pointers to void generic function pointers.

Both GCC and Clang emit warnings for this when in pedantic mode.

This commit fixes this by modifying the compare function to comply with
the expected signature.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-26 23:52:56 +02:00
Andreas Rheinhardt 16ea88778e avfilter/vf_signature: Fix leak of string upon error
If an error happens between allocating a string intended to be used as
an inpad's name and attaching it to its input pad, the string leaks.
Fix this by inserting the inpad directly after allocating its string.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-26 23:52:56 +02:00
Andreas Rheinhardt 37838417b8 avfilter/vf_signature: Fix leak of inpads' names
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-26 23:52:56 +02:00
Andreas Rheinhardt 8129c32e48 avcodec, avfilter, avformat: Remove redundant avpriv_align_put_bits
flush_put_bits() already fills the bitstream with zeroes, so it is
unnecessary to align the bitstream before.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-01 18:56:32 +02:00
Michael Niedermayer 35eeff30ca avfilter/vf_signature: use av_strlcpy()
Fixes: out of array access

Found-by: Kira <kira_cxy@foxmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-01 02:58:51 +02:00
Timo Rothenpieler feb13aed79 avfilter/vf_signature: fix memory leaks in error cases
Fixes CIDs 1403234 and 1403235
2017-06-13 19:49:39 +02:00
Michael Niedermayer eaf6f10f1b avfilter/vf_signature: Replace uncommon spelling of seperate
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-26 20:34:47 +02:00
Gerion Entrup 5e3a418b60 add signature filter for MPEG7 video signature
This filter does not implement all features of MPEG7. Missing features:
- compression of signature files
- work only on (cropped) parts of the video

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-21 00:11:08 +01:00