From e8a9f7acdf8ee5955415f4799c38dac7a944adaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 18 Apr 2013 00:44:32 +0100 Subject: [PATCH] printf: fix handling of old printf extension specifiers for ABI compatibility Fixes abort when the old specifiers are used. Fix up the conversion specifier, it would get overwritten with 'c' below to the extension format char, which then later is unhandled, leading to the abort. Also fix up and enable unit test for this. https://bugzilla.gnome.org/process_bug.cgi --- gst/printf/printf-parse.c | 4 ++-- tests/check/gst/gstinfo.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gst/printf/printf-parse.c b/gst/printf/printf-parse.c index 300984ab7f..5d60448108 100644 --- a/gst/printf/printf-parse.c +++ b/gst/printf/printf-parse.c @@ -392,7 +392,7 @@ printf_parse (const char *format, char_directives * d, arguments * a) type = TYPE_POINTER_EXT; dp->flags |= FLAG_PTR_EXT; dp->ptr_ext_char = 'A'; - dp->conversion = 'p'; + c = 'p'; break; case 'p': /* Note: cp points already to the char after the 'p' now */ @@ -413,7 +413,7 @@ printf_parse (const char *format, char_directives * d, arguments * a) type = TYPE_POINTER_EXT; dp->flags |= FLAG_PTR_EXT; dp->ptr_ext_char = 'B'; - dp->conversion = 'p'; + c = 'p'; break; case 'n': #ifdef HAVE_LONG_LONG diff --git a/tests/check/gst/gstinfo.c b/tests/check/gst/gstinfo.c index 99bfcee59f..29f272c1dc 100644 --- a/tests/check/gst/gstinfo.c +++ b/tests/check/gst/gstinfo.c @@ -290,10 +290,18 @@ GST_START_TEST (info_old_printf_extensions) fail_unless_equals_int (g_list_length (messages), 1); str = (gchar *) messages->data; fail_unless (str != NULL); - fail_unless (strstr (str, "foo/bar") != NULL); - fail_unless (strstr (str, "width = (int) 4096") != NULL); - fail_unless (strstr (str, "framerate = (fraction) 50/1") != NULL); + + GST_INFO ("str = '%s'", str); + fail_unless (strstr (str, "time") != NULL); + fail_unless (strstr (str, "start=0:00:00.000000000") != NULL); + fail_unless (strstr (str, "stop=99:99:99.999999999") != NULL); + fail_unless (strstr (str, "applied_rate=1.000000") != NULL); + + fail_unless (strstr (str, " caps are ") != NULL); + fail_unless (strstr (str, "foo/bar") != NULL); + fail_unless (strstr (str, "width=(int)4096") != NULL); + fail_unless (strstr (str, "framerate=(fraction)50/1") != NULL); fail_unless (strstr (str, "ARGB") != NULL); /* clean up */ @@ -323,7 +331,7 @@ gst_info_suite (void) tcase_add_test (tc_chain, info_log_handler); tcase_add_test (tc_chain, info_dump_mem); tcase_add_test (tc_chain, info_fixme); - tcase_skip_broken_test (tc_chain, info_old_printf_extensions); + tcase_add_test (tc_chain, info_old_printf_extensions); #endif return s;