diff options
author | Philip Jägenstedt <philipj@opera.com> | 2010-05-13 09:18:56 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2010-05-19 20:35:06 +0200 |
commit | 9c1267b1a92068914cbf9cab9db48107797f1588 (patch) | |
tree | 5ff4851ab09b55a75f094a25dc33f87e485bcc3f | |
parent | c712d2879655ecf0e503e06cd32eb058ef1af047 (diff) |
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
-rw-r--r-- | gst/matroska/ebml-read.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gst/matroska/ebml-read.c b/gst/matroska/ebml-read.c index e53027afa..6ea70f2d8 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; } |