H264, H265: Fix overflow value of se(v)

For signed exponential Golomb, fix a typo when testing if
value was even or odd that resulted in a no-op. This was
mapping all overflows to G_MININT32 instead of half of them
to G_MAXINT32.
This commit is contained in:
John Thacker 2022-11-23 07:44:55 -05:00
parent e6d81e8731
commit 26dda2ba78
2 changed files with 6 additions and 6 deletions

View File

@ -688,8 +688,8 @@ dissect_h264_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint
overflow = TRUE;
codenum = G_MAXUINT32;
if (descriptor == H264_SE_V) {
value = tvb_get_bits32(tvb, bit_offset + leading_zero_bits / 32, leading_zero_bits % 32, ENC_BIG_ENDIAN);
if (value % 1) {
value = tvb_get_bits32(tvb, bit_offset + 32*(leading_zero_bits / 32), leading_zero_bits % 32, ENC_BIG_ENDIAN);
if (value % 2) {
se_value = G_MININT32;
} else {
se_value = G_MAXINT32;
@ -705,7 +705,7 @@ dissect_h264_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint
if (value != 1) {
overflow = TRUE;
}
if (value % 1) {
if (value % 2) {
se_value = G_MININT32;
} else {
se_value = G_MAXINT32;

View File

@ -937,8 +937,8 @@ dissect_h265_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, pack
codenum = G_MAXUINT32;
if (descriptor == H265_SE_V) {
/* For signed, must read the last bit to get the sign. */
value = tvb_get_bits32(tvb, bit_offset + leading_zero_bits / 32, leading_zero_bits % 32, ENC_BIG_ENDIAN);
if (value % 1) {
value = tvb_get_bits32(tvb, bit_offset + 32*(leading_zero_bits / 32), leading_zero_bits % 32, ENC_BIG_ENDIAN);
if (value % 2) {
se_value = G_MININT32;
} else {
se_value = G_MAXINT32;
@ -954,7 +954,7 @@ dissect_h265_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, pack
if (value != 1) {
overflow = TRUE;
}
if (value % 1) {
if (value % 2) {
se_value = G_MININT32;
} else {
se_value = G_MAXINT32;