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:
Sebastian Dröge 2012-03-06 14:16:21 +01:00
parent dad2a52f62
commit 78079635a6

View File

@ -336,12 +336,14 @@ gst_rtp_dv_depay_process (GstBaseRTPDepayload * base, GstBuffer * in)
GST_LOG_OBJECT (dvdepay, "got block at location %d", location); GST_LOG_OBJECT (dvdepay, "got block at location %d", location);
} }
if (location != -1) {
/* get the byte offset of the dif block */ /* get the byte offset of the dif block */
offset = location * 80; offset = location * 80;
/* And copy it in, provided the location is sane. */ /* And copy it in, provided the location is sane. */
if (offset >= 0 && offset <= dvdepay->frame_size - 80) if (offset <= dvdepay->frame_size - 80)
memcpy (GST_BUFFER_DATA (dvdepay->acc) + offset, payload, 80); memcpy (GST_BUFFER_DATA (dvdepay->acc) + offset, payload, 80);
}
payload += 80; payload += 80;
payload_len -= 80; payload_len -= 80;