From 9c1267b1a92068914cbf9cab9db48107797f1588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Thu, 13 May 2010 09:18:56 +0200 Subject: [PATCH] ebml: don't modify out str if returning an error in _read_ascii This is a regression from ASCII validation changes. Test case: bug_s66876390_r0.001____malloc_printerr.webm --- gst/matroska/ebml-read.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gst/matroska/ebml-read.c b/gst/matroska/ebml-read.c index e53027afab..6ea70f2d8f 100644 --- a/gst/matroska/ebml-read.c +++ b/gst/matroska/ebml-read.c @@ -802,28 +802,30 @@ gst_ebml_read_string (GstEbmlRead * ebml, guint32 * id, gchar ** str) */ GstFlowReturn -gst_ebml_read_ascii (GstEbmlRead * ebml, guint32 * id, gchar ** str) +gst_ebml_read_ascii (GstEbmlRead * ebml, guint32 * id, gchar ** str_out) { GstFlowReturn ret; + gchar *str; gchar *iter; #ifndef GST_DISABLE_GST_DEBUG guint64 oldoff = ebml->offset; #endif - ret = gst_ebml_read_string (ebml, id, str); + ret = gst_ebml_read_string (ebml, id, &str); if (ret != GST_FLOW_OK) return ret; - for (iter = *str; *iter != '\0'; iter++) { + for (iter = str; *iter != '\0'; iter++) { if (G_UNLIKELY (*iter & 0x80)) { GST_ERROR_OBJECT (ebml, "Invalid ASCII string at offset %" G_GUINT64_FORMAT, oldoff); - g_free (*str); + g_free (str); return GST_FLOW_ERROR; } } + *str_out = str; return ret; }