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 b86fbb3 commit 00d8e76
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) ||
if (raw_keylen < 0.0 || isnan(raw_keylen) || isinf(raw_keylen) ||

This comment has been minimized.

Copy link
@Martii

Martii Aug 7, 2018

This comment has been minimized.

Copy link
@MylesBorins

MylesBorins Aug 7, 2018

Contributor

this is now fixed in staging (this commit has been rebased out)

raw_keylen > INT_MAX) {
type_error = "Bad key length";
goto err;
Expand Down

0 comments on commit 00d8e76

Please sign in to comment.