evas filters: Fix minor issue with print
authorJean-Philippe Andre <jp.andre@samsung.com>
Tue, 9 Aug 2016 02:19:11 +0000 (11:19 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 9 Aug 2016 02:43:52 +0000 (11:43 +0900)
If the call to tostring() fails, replace the string by (invalid)
rather than ignore the error.

Fixes CID 1308612

src/lib/evas/filters/evas_filter_parser.c

index 7b33b04..d45b883 100644 (file)
@@ -2202,8 +2202,13 @@ _lua_print(lua_State *L)
         lua_getglobal(L, _lua_errfunc_name);
         lua_getglobal(L, "tostring"); //+1
         lua_pushvalue(L, i); //+1
-        lua_pcall(L, 1, 1, -3); //-2/+1
-        str = lua_tostring(L, -1);
+        if (lua_pcall(L, 1, 1, -3) == 0) //-2/+1
+          str = lua_tostring(L, -1);
+        else
+          {
+             ERR("tostring() failed inside print(): %s", lua_tostring(L, -1));
+             str = "(invalid)";
+          }
         eina_strbuf_append(s, str ? str : "(nil)");
         lua_pop(L, 2);
         eina_strbuf_append_char(s, ' ');