edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Chris Brannon <chris@the-brannons.com>
To: edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] javaParseExecute incorrect use of variable
Date: Sat, 18 Jan 2014 10:23:00 -0800	[thread overview]
Message-ID: <871u05up2z.fsf@mushroom.PK5001Z> (raw)

This is mainly for Adam, so he can fix it in his jsdom.cpp.  I'll fix it
in jsdom.c on the master branch shortly.

Here's a fragment of the documentation for JS_EvaluateScript:

If a script compiles and executes successfully,
JS_EvaluateScript or JS_EvaluateUCScript stores the result in *rval,
if non-null, and returns JS_TRUE. Otherwise it returns JS_FALSE and the value
left in *rval is undefined. 

Here's what we do, from line 1089 of jsdom.c on master:

    ok = JS_EvaluateScript(jcx, this, str, strlen(str),
       filename, lineno, &rval);
    rc = eb_true;
    if(JSVAL_IS_BOOLEAN(rval))
	rc = JSVAL_TO_BOOLEAN(rval);

We never check "ok".  If "ok" is false, the contents of rval shouldn't
be used, since they are undefined.

-- Chris

             reply	other threads:[~2014-01-18 18:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-18 18:23 Chris Brannon [this message]
2014-01-19 15:11 ` Adam Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871u05up2z.fsf@mushroom.PK5001Z \
    --to=chris@the-brannons.com \
    --cc=edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).