Skip to content

Commit

Permalink
crypto: Use math.h definitions of isnan and isinf
Browse files Browse the repository at this point in the history
Unless you specify C++11, std::isnan and std::isinf are not guaranteed to be available. Instead, just use the math.h functions for now.

PR-URL: #19196
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yihong Wang <yh.wang@ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
jer-gentoo authored and MylesBorins committed Aug 7, 2018
1 parent 2abfea0 commit d8cf13a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
#include "v8.h"

#include <algorithm>
#include <cmath>
#include <errno.h>
#include <limits.h> // INT_MAX
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
Expand Down Expand Up @@ -5610,7 +5610,7 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
}

raw_keylen = args[3]->NumberValue();
if (raw_keylen < 0.0 || std::isnan(raw_keylen) || std::isinf(raw_keylen) ||

This comment has been minimized.

Copy link
@Martii

Martii Aug 7, 2018

@MylesBorins Cc: @jer-gentoo @yhwang @jasnell @addaleax

Re: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891#c2

Is this a broken cherry pick? This commit doesn't seem to match the combined commits in #19196

See also 00d8e76

This comment has been minimized.

Copy link
@MylesBorins

MylesBorins Aug 7, 2018

Contributor

fixed in staging, this commit is rebased out

if (raw_keylen < 0.0 || isnan(raw_keylen) || isinf(raw_keylen) ||
raw_keylen > INT_MAX) {
type_error = "Bad key length";
goto err;
Expand Down

0 comments on commit d8cf13a

Please sign in to comment.