[Bug 748389] validate-utils: Passing value -1.0 to sqrt() leads to undefined result

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri May 29 07:27:23 PDT 2015


https://bugzilla.gnome.org/show_bug.cgi?id=748389

--- Comment #5 from Luis de Bethencourt <luis at debethencourt.com> ---
What I expected.

#include <math.h>
#include <stdio.h>

int main () {
  printf ("%f\n", sqrt (-1.0));
  return 0;
}

Returns "-nan"

Good find! :)

One thing though.

  else {
      return -1.0;
  }
  return -1.0;

Why the need for an else there?

Change this to be the following and I will merge:

  if (!setjmp (parser->err_jmp_buf)) {
    result = _read_expr (parser);
    if (parser->pos < parser->len - 1) {
      _error (parser,
          "Failed to reach end of input expression, likely malformed input");
    } else
      return result;
  }

  return -1.0;

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list