[gjs] log: check that the stack is a string before converting
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] log: check that the stack is a string before converting
- Date: Tue, 7 May 2013 18:14:50 +0000 (UTC)
commit e3fdf9e3876b8a0649b88ab1672e88395a76521f
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue May 7 20:10:59 2013 +0200
log: check that the stack is a string before converting
gjs_string_to_utf8 goes crazy if you call it on something that is
not on a string, and it is legitimate to call logError() with
objects that don't have a stack (such as pure GLib.Errors)
gjs/jsapi-util.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index de97ab5..5ba0711 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -525,7 +525,8 @@ gjs_log_exception_full(JSContext *context,
if (JSVAL_IS_OBJECT(exc) &&
gjs_object_get_property_const(context, JSVAL_TO_OBJECT(exc),
- GJS_STRING_STACK, &stack))
+ GJS_STRING_STACK, &stack) &&
+ JSVAL_IS_STRING(stack))
gjs_string_to_utf8(context, stack, &utf8_stack);
else
utf8_stack = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]