Working with valgrind to clean a giant networking application I was getting "Conditional jump or move depends on uninitialised value(s)" with js stacks (see below), took a long time but managed to zero in on reason.
==28440== Conditional jump or move depends on uninitialised value(s)
==28440== at 0xA7EBB08780A: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
==28440== by 0xA7EBB0118D4: ???
Running the following code through valgrind will trigger the error
const alloc = process.env.SAFE ? Buffer.alloc : Buffer.allocUnsafe;
var buf = alloc(20);
buf.writeInt32BE(123, 2);
>valgrind --gen-suppressions=yes --leak-check=full /var/lib/nave/global/10.13.0/bin/node a.js
I've managed to trace the cause to lib/internal/buffer.js:checkBounds accessing the buffer that isn't initialized.
Buffer.allocUnsafe used by ws npm module
Shachar
Working with valgrind to clean a giant networking application I was getting "Conditional jump or move depends on uninitialised value(s)" with js stacks (see below), took a long time but managed to zero in on reason.
Running the following code through valgrind will trigger the error
>valgrind --gen-suppressions=yes --leak-check=full /var/lib/nave/global/10.13.0/bin/node a.jsI've managed to trace the cause to
lib/internal/buffer.js:checkBoundsaccessing the buffer that isn't initialized.Buffer.allocUnsafeused bywsnpm moduleShachar