diff mbox series

[FFmpeg-devel,4/6] avutil/common: warn about possible move of the data pointer after the last 0 byte in GET_UTF8

Message ID 20200129233235.3325-4-cus@passwd.hu
State Accepted
Headers show
Series [FFmpeg-devel,1/6] avutil/common: use unsigned int in GET_UTF8 | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Marton Balint Jan. 29, 2020, 11:32 p.m. UTC
Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavutil/common.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Jan. 30, 2020, 10:41 a.m. UTC | #1
lgtm

On 1/30/20, Marton Balint <cus@passwd.hu> wrote:
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavutil/common.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/common.h b/libavutil/common.h
> index e6f076a13c..142ff9abe7 100644
> --- a/libavutil/common.h
> +++ b/libavutil/common.h
> @@ -373,7 +373,9 @@ static av_always_inline av_const int
> av_parity_c(uint32_t v)
>   * @param GET_BYTE Expression reading one byte from the input.
>   *                 Evaluated up to 7 times (4 for the currently
>   *                 assigned Unicode range).  With a memory buffer
> - *                 input, this could be *ptr++.
> + *                 input, this could be *ptr++, or if you want to make sure
> + *                 that *ptr stops at the end of a NULL terminated string
> then
> + *                 *ptr ? *ptr++ : 0
>   * @param ERROR    Expression to be evaluated on invalid input,
>   *                 typically a goto statement.
>   *
> --
> 2.16.4
>
> _______________________________________________
> 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".
diff mbox series

Patch

diff --git a/libavutil/common.h b/libavutil/common.h
index e6f076a13c..142ff9abe7 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -373,7 +373,9 @@  static av_always_inline av_const int av_parity_c(uint32_t v)
  * @param GET_BYTE Expression reading one byte from the input.
  *                 Evaluated up to 7 times (4 for the currently
  *                 assigned Unicode range).  With a memory buffer
- *                 input, this could be *ptr++.
+ *                 input, this could be *ptr++, or if you want to make sure
+ *                 that *ptr stops at the end of a NULL terminated string then
+ *                 *ptr ? *ptr++ : 0
  * @param ERROR    Expression to be evaluated on invalid input,
  *                 typically a goto statement.
  *