mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
matroska: rejig test to avoid undefined shift behavior
Coverity 1195121, 1195120
This commit is contained in:
parent
1da2fd457d
commit
ec38c62563
1 changed files with 2 additions and 2 deletions
|
@ -349,7 +349,7 @@ gst_ebml_write_element_size (guint8 ** data_inout, guint64 size)
|
||||||
|
|
||||||
if (size != GST_EBML_SIZE_UNKNOWN) {
|
if (size != GST_EBML_SIZE_UNKNOWN) {
|
||||||
/* how many bytes? - use mask-1 because an all-1 bitset is not allowed */
|
/* how many bytes? - use mask-1 because an all-1 bitset is not allowed */
|
||||||
while ((size >> ((bytes - 1) * 8)) >= (mask - 1) && bytes <= 8) {
|
while (bytes <= 8 && (size >> ((bytes - 1) * 8)) >= (mask - 1)) {
|
||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
bytes++;
|
bytes++;
|
||||||
}
|
}
|
||||||
|
@ -530,7 +530,7 @@ gst_ebml_write_get_uint_size (guint64 num)
|
||||||
guint size = 1;
|
guint size = 1;
|
||||||
|
|
||||||
/* get size */
|
/* get size */
|
||||||
while (num >= (G_GINT64_CONSTANT (1) << (size * 8)) && size < 8) {
|
while (size < 8 && num >= (G_GINT64_CONSTANT (1) << (size * 8))) {
|
||||||
size++;
|
size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue