mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
zlib: coerce -0 to +0 for crc32 seeds
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/63556 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
1 parent
c55dd030e6
commit
7433c3df2e
2 files changed
+10
No files matched your search
@@ -969,6 +969,8 @@ function crc32(data, value = 0) {
|
||||
throw new ERR_INVALID_ARG_TYPE('data', ['Buffer', 'TypedArray', 'DataView', 'string'], data);
|
||||
}
|
||||
validateUint32(value, 'value');
|
||||
// Coerce -0 to +0.
|
||||
value += 0;
|
||||
return crc32Native(data, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
|
||||
const assert = require('assert');
|
||||
const zlib = require('zlib');
|
||||
|
||||
assert.strictEqual(zlib.crc32('', -0), zlib.crc32('', 0));
|
||||
Reference in new issue
Block a user