From cfc1efc0897cd0312e8c5ab2c4db7fa0e60d45e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Se=C3=A1n=20de=20B=C3=BArca?= <leftmostcat@gmail.com>
Date: Wed, 11 Sep 2013 13:11:58 -0600
Subject: [PATCH] Fix off-by-one in validation of UTF-8

---
 gst/matroska/matroska-demux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 1e8a560..ac2a545 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -3006,7 +3006,7 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element,
     return GST_FLOW_OK;
 
   if (!sub_stream->invalid_utf8) {
-    if (g_utf8_validate ((gchar *) map.data, map.size, NULL)) {
+    if (g_utf8_validate ((gchar *) map.data, map.size - 1, NULL)) {
       goto next;
     }
     GST_WARNING_OBJECT (element, "subtitle stream %" G_GUINT64_FORMAT
-- 
1.8.3.1

