From 78079635a6a29812d8dfb88d30b298b64eb80d41 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 6 Mar 2012 14:16:21 +0100 Subject: [PATCH] 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. --- gst/rtp/gstrtpdvdepay.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gst/rtp/gstrtpdvdepay.c b/gst/rtp/gstrtpdvdepay.c index 4098c39..43e6aa1 100644 --- a/gst/rtp/gstrtpdvdepay.c +++ b/gst/rtp/gstrtpdvdepay.c @@ -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; -- 2.7.4