mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
dvdepay: Fix 'comparison of unsigned expression >= 0 is always true' compiler warning
This was an actual bug as it could've caused reading from invalid memory areas when the input is broken.
This commit is contained in:
parent
dad2a52f62
commit
78079635a6
1 changed files with 7 additions and 5 deletions
|
@ -336,12 +336,14 @@ gst_rtp_dv_depay_process (GstBaseRTPDepayload * base, GstBuffer * in)
|
|||
GST_LOG_OBJECT (dvdepay, "got block at location %d", location);
|
||||
}
|
||||
|
||||
/* get the byte offset of the dif block */
|
||||
offset = location * 80;
|
||||
if (location != -1) {
|
||||
/* get the byte offset of the dif block */
|
||||
offset = location * 80;
|
||||
|
||||
/* And copy it in, provided the location is sane. */
|
||||
if (offset >= 0 && offset <= dvdepay->frame_size - 80)
|
||||
memcpy (GST_BUFFER_DATA (dvdepay->acc) + offset, payload, 80);
|
||||
/* And copy it in, provided the location is sane. */
|
||||
if (offset <= dvdepay->frame_size - 80)
|
||||
memcpy (GST_BUFFER_DATA (dvdepay->acc) + offset, payload, 80);
|
||||
}
|
||||
|
||||
payload += 80;
|
||||
payload_len -= 80;
|
||||
|
|
Loading…
Reference in a new issue