Commit fe0f015c authored by Ben Noordhuis's avatar Ben Noordhuis
Browse files

src: fix crypto bio integer wraparound on 32 bits

Fix a bug where a size_t was negated and passed to a function that takes
an int64_t.  It works by accident when sizeof(size_t) == sizeof(int64_t)
but it causes the value to underflow when size_t is a 32 bits type.

v8::Isolate::AdjustAmountOfExternalAllocatedMemory() is the function I'm
talking about.  The goal of that call is to tell V8 that some memory has
been freed but due to that underflow, we were actually reporting that we
had just allocated gigabytes of memory.  It set off a garbage collector
frenzy and essentially brought the VM to a standstill.

Fixes: https://github.com/iojs/io.js/issues/1188
PR-URL: https://github.com/iojs/io.js/pull/1192


Reviewed-By: default avatarFedor Indutny <fedor@indutny.com>
parent 2b63bcd2
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment