[gjs] gjs_parse_args() wrong check with format 'u'
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] gjs_parse_args() wrong check with format 'u'
- Date: Thu, 10 Oct 2013 20:43:12 +0000 (UTC)
commit 4fba3073e1d9376debcae1c79ddd6988a9f47131
Author: Sebastien Lafargue <slaf66 gmail com>
Date: Wed Sep 18 00:03:45 2013 +0200
gjs_parse_args() wrong check with format 'u'
Only positive integers must pass the check but actually, strings can pass
( even with no digit in, with a result of 0 )
https://bugzilla.gnome.org/show_bug.cgi?id=707297
gjs/jsapi-util.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index 15b42ac..203621a 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -996,7 +996,7 @@ gjs_parse_args (JSContext *context,
break;
case 'u': {
gdouble num;
- if (!JS_ValueToNumber(context, js_value, &num)) {
+ if (!JSVAL_IS_NUMBER(js_value) || !JS_ValueToNumber(context, js_value, &num)) {
/* Our error message is going to be more useful */
JS_ClearPendingException(context);
arg_error_message = "Couldn't convert to unsigned integer";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]