Commit 9c1267b1 authored by Philip Jägenstedt's avatar Philip Jägenstedt Committed by Sebastian Dröge
Browse files

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
parent c712d287
...@@ -802,28 +802,30 @@ gst_ebml_read_string (GstEbmlRead * ebml, guint32 * id, gchar ** str) ...@@ -802,28 +802,30 @@ gst_ebml_read_string (GstEbmlRead * ebml, guint32 * id, gchar ** str)
*/ */
GstFlowReturn GstFlowReturn
gst_ebml_read_ascii (GstEbmlRead * ebml, guint32 * id, gchar ** str) gst_ebml_read_ascii (GstEbmlRead * ebml, guint32 * id, gchar ** str_out)
{ {
GstFlowReturn ret; GstFlowReturn ret;
gchar *str;
gchar *iter; gchar *iter;
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
guint64 oldoff = ebml->offset; guint64 oldoff = ebml->offset;
#endif #endif
ret = gst_ebml_read_string (ebml, id, str); ret = gst_ebml_read_string (ebml, id, &str);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
return ret; return ret;
for (iter = *str; *iter != '\0'; iter++) { for (iter = str; *iter != '\0'; iter++) {
if (G_UNLIKELY (*iter & 0x80)) { if (G_UNLIKELY (*iter & 0x80)) {
GST_ERROR_OBJECT (ebml, GST_ERROR_OBJECT (ebml,
"Invalid ASCII string at offset %" G_GUINT64_FORMAT, oldoff); "Invalid ASCII string at offset %" G_GUINT64_FORMAT, oldoff);
g_free (*str); g_free (str);
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
} }
*str_out = str;
return ret; return ret;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment