[FFmpeg-devel] [PATCH 8/8] avformat/mpegts: return proper error codes
Marton Balint
cus at passwd.hu
Thu Oct 14 22:46:37 EEST 2021
On Thu, 14 Oct 2021, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> libavformat/mpegts.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
No, parse_stream_identifier_desc intentionally returns -1 for error, check
how the code works which uses the function.
Regards,
Marton
>
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index 774964d..3157e3a 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -2270,22 +2270,22 @@ static int parse_stream_identifier_desc(const uint8_t *p, const uint8_t *p_end)
>
> desc_list_len = get16(pp, p_end);
> if (desc_list_len < 0)
> - return -1;
> + return AVERROR_INVALIDDATA;
> desc_list_len &= 0xfff;
> desc_list_end = p + desc_list_len;
> if (desc_list_end > p_end)
> - return -1;
> + return AVERROR_INVALIDDATA;
>
> while (1) {
> desc_tag = get8(pp, desc_list_end);
> if (desc_tag < 0)
> - return -1;
> + return AVERROR_INVALIDDATA;
> desc_len = get8(pp, desc_list_end);
> if (desc_len < 0)
> - return -1;
> + return AVERROR_INVALIDDATA;
> desc_end = *pp + desc_len;
> if (desc_end > desc_list_end)
> - return -1;
> + return AVERROR_INVALIDDATA;
>
> if (desc_tag == 0x52) {
> return get8(pp, desc_end);
> @@ -2293,7 +2293,7 @@ static int parse_stream_identifier_desc(const uint8_t *p, const uint8_t *p_end)
> *pp = desc_end;
> }
>
> - return -1;
> + return AVERROR_INVALIDDATA;
> }
>
> static int is_pes_stream(int stream_type, uint32_t prog_reg_desc)
> --
> 1.8.3.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-devel
mailing list