Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 05/22] avformat/matroskadec: Use int64_t size
Date: Fri, 12 Jul 2024 10:42:38 +0200
Message-ID: <DU0P250MB0747D7A28C62D3D1EC6B71848FA62@DU0P250MB0747.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20240711233417.1896879-5-michael@niedermayer.cc>

Michael Niedermayer:
> The length is 64bit that is passed into the functions.
> Alternatively the values can be checked before cast
> 
> Fixes: CID1604572 Overflowed return value
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/matroskadec.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index aa28a37da4c..9914838698c 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -989,7 +989,7 @@ static int ebml_read_length(MatroskaDemuxContext *matroska, AVIOContext *pb,
>   * Read the next element as an unsigned int.
>   * Returns NEEDS_CHECKING unless size == 0.
>   */
> -static int ebml_read_uint(AVIOContext *pb, int size,
> +static int ebml_read_uint(AVIOContext *pb, int64_t size,
>                            uint64_t default_value, uint64_t *num)
>  {
>      int n = 0;
> @@ -1010,7 +1010,7 @@ static int ebml_read_uint(AVIOContext *pb, int size,
>   * Read the next element as a signed int.
>   * Returns NEEDS_CHECKING unless size == 0.
>   */
> -static int ebml_read_sint(AVIOContext *pb, int size,
> +static int ebml_read_sint(AVIOContext *pb, int64_t size,
>                            int64_t default_value, int64_t *num)
>  {
>      int n = 1;
> @@ -1033,7 +1033,7 @@ static int ebml_read_sint(AVIOContext *pb, int size,
>   * Read the next element as a float.
>   * Returns 0 if size == 0, NEEDS_CHECKING or < 0 on obvious failure.
>   */
> -static int ebml_read_float(AVIOContext *pb, int size,
> +static int ebml_read_float(AVIOContext *pb, int64_t size,
>                             double default_value, double *num)
>  {
>      if (size == 0) {

The values are already checked before that (via the max_lengths list).

- Andreas

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

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

  reply	other threads:[~2024-07-12  8:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11 23:33 [FFmpeg-devel] [PATCH 01/22] avformat/asfdec_o: Check size of index object Michael Niedermayer
2024-07-11 23:33 ` [FFmpeg-devel] [PATCH 02/22] avformat/bintext: Check avio_size() return Michael Niedermayer
2024-07-11 23:33 ` [FFmpeg-devel] [PATCH 03/22] avformat/hlsenc: Check ret Michael Niedermayer
2024-07-11 23:33 ` [FFmpeg-devel] [PATCH 04/22] avformat/hnm: Check *chunk_size Michael Niedermayer
2024-07-11 23:33 ` [FFmpeg-devel] [PATCH 05/22] avformat/matroskadec: Use int64_t size Michael Niedermayer
2024-07-12  8:42   ` Andreas Rheinhardt [this message]
2024-07-12 14:59     ` Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 06/22] avformat/mm: Check length Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 07/22] avformat/mov: Use 64bit for str_size Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 08/22] avformat/mp3dec; Check for avio_size() failure Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 09/22] avformat/mp3dec: Check header_filesize Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 10/22] avformat/nsvdec: Check asize for PCM Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 11/22] avformat/sapdec: Check ffurl_get_file_handle() for error Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 12/22] avformat/sauce: Check avio_size() for failure Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 13/22] avformat/siff: Basic pkt_size check Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 14/22] avformat/tty: Check avio_size() Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 15/22] avformat/ty: rec_size seems to only need 32bit Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 16/22] avformat/webpenc: Check filesize in trailer Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 17/22] avformat/xmv: Check this_packet_size Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 18/22] avutil/avsscanf: Remove dead code Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 19/22] avutil/buffer: Check ff_mutex_init() for failure Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 20/22] avutil/frame: Check log2_crop_align Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 21/22] avutil/slicethread: Check pthread_*_init() for failure Michael Niedermayer
2024-07-11 23:34 ` [FFmpeg-devel] [PATCH 22/22] avfilter/vf_xfade: Check ff_inlink_consume_frame() " Michael Niedermayer
2024-07-21 14:43 ` [FFmpeg-devel] [PATCH 01/22] avformat/asfdec_o: Check size of index object Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DU0P250MB0747D7A28C62D3D1EC6B71848FA62@DU0P250MB0747.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git