[FFmpeg-devel,V5,1/4] lavc/golomb: add value range comment for set_ue_golomb().

Submitted by Jun Zhao on June 14, 2017, 3 a.m.

Details

Message ID a17a58c2-f611-383f-1383-3ae7be7bc5c2@gmail.com
State Accepted
Commit ea1d07aed96a170d2aaf68a96822485dd20cb346
Headers show

Commit Message

Jun Zhao June 14, 2017, 3 a.m.
V5: Split the patch.
V4: Fix rang check error in assert base on Mark's review
V3: Clean the code logic base on Michael's review.
V2: Add set_ue_golomb_long() to support 32bits UE golomb and update the unit test.
From 4600950115a215d64cf049233195cfd035ac11cb Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao@intel.com>
Date: Wed, 14 Jun 2017 10:08:58 +0800
Subject: [PATCH V5 1/4] lavc/golomb: add value range comment for
 set_ue_golomb().

set_ue_golomb just support 2^16 - 2 at most, becase this function call
put_bits, and put_bits just support write up to 31 bits, when write 32
bit in put_bits, it's will overwrite the bit buffer, and the default
assert level is 0, the av_assert2(n <= 31 && value < (1U << n)) in
put_bits can not be trigger runtime.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
---
 libavcodec/golomb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jun Zhao June 19, 2017, 12:52 a.m.
On 2017/6/14 11:00, Jun Zhao wrote:
> V5: Split the patch.
> V4: Fix rang check error in assert base on Mark's review
> V3: Clean the code logic base on Michael's review.
> V2: Add set_ue_golomb_long() to support 32bits UE golomb and update the unit test.
>

ping ?
Jun Zhao June 23, 2017, 12:28 a.m.
On 2017/6/19 8:52, Jun Zhao wrote:
> On 2017/6/14 11:00, Jun Zhao wrote:
>> V5: Split the patch.
>> V4: Fix rang check error in assert base on Mark's review
>> V3: Clean the code logic base on Michael's review.
>> V2: Add set_ue_golomb_long() to support 32bits UE golomb and update the unit test.
>>
> 
> ping ?
> 
>  

Again or need a other round review or comments ?
Michael Niedermayer June 23, 2017, 11:04 a.m.
On Wed, Jun 14, 2017 at 11:00:50AM +0800, Jun Zhao wrote:
> V5: Split the patch.
> V4: Fix rang check error in assert base on Mark's review
> V3: Clean the code logic base on Michael's review.
> V2: Add set_ue_golomb_long() to support 32bits UE golomb and update the unit test.

>  golomb.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 4272a9227cf925217ba1b3349e3209421bea198b  0001-lavc-golomb-add-value-range-comment-for-set_ue_golom.patch
> From 4600950115a215d64cf049233195cfd035ac11cb Mon Sep 17 00:00:00 2001
> From: Jun Zhao <jun.zhao@intel.com>
> Date: Wed, 14 Jun 2017 10:08:58 +0800
> Subject: [PATCH V5 1/4] lavc/golomb: add value range comment for
>  set_ue_golomb().
> 
> set_ue_golomb just support 2^16 - 2 at most, becase this function call
> put_bits, and put_bits just support write up to 31 bits, when write 32
> bit in put_bits, it's will overwrite the bit buffer, and the default
> assert level is 0, the av_assert2(n <= 31 && value < (1U << n)) in
> put_bits can not be trigger runtime.
> 
> Signed-off-by: Jun Zhao <jun.zhao@intel.com>
> ---
>  libavcodec/golomb.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 4f5514795a..1e834f9327 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -458,7 +458,7 @@  static inline int get_te(GetBitContext *s, int r, char *file, const char *func,
 #endif /* TRACE */
 
 /**
- * write unsigned exp golomb code.
+ * write unsigned exp golomb code. 2^16 - 2 at most
  */
 static inline void set_ue_golomb(PutBitContext *pb, int i)
 {