util: print External address from inspect#34398
util: print External address from inspect#34398rosaxxny wants to merge 3 commits intonodejs:masterfrom
Conversation
src/node_util.cc
Outdated
There was a problem hiding this comment.
This is nice! Thank you!
This is not a blocker at all, but I'd prefer specify the type
| auto isolate = args.GetIsolate(); | |
| Isolate* isolate = args.GetIsolate(); |
Just a sugestion, not a blocker.
|
I think this always prints the pointer, unlike what @addaleax suggested in #28250 (comment). Anna expressed potential security concerns there. |
|
@tniessen Yeah, it’s … not simple. On the one hand, the pointer should not end up in the hands of an attacker – on the other hand, if you’re publicly sharing debugging information for internal objects, like |
|
I am not overly concerned either. Are there any objects returned by core APIs that contain externals that would expose internal pointers when |
|
@tniessen No, Node.js core should currently be fine anyway. We only use |
src/node_util.cc
Outdated
There was a problem hiding this comment.
%p can either format the pointer as 1234abcde or 0x1234abcd, and there's also potential inconsistency around NULL pointers. I'd cast the pointer to uint64_t and format it with PRIx64 from <cinttypes>.
An alternative solution is to turn the pointer into a BigInt with v8::BigInt::NewFromUnsigned() and do the formatting in JS land with value.toString(16).
test/parallel/test-util-inspect.js
Outdated
There was a problem hiding this comment.
Can you check that the value is a non-empty hex string?
There was a problem hiding this comment.
| /^\[External: .*?\]$/); | |
| /^\[External: [0-9a-f]+\]$/); |
|
@juanarbol @bnoordhuis @tniessen Updated, PTAL. |
|
Changes still LGTM, but the branch seems to have unrelated changes. Maybe a merge commit is the problem? |
0387c8d to
880c5b1
Compare
|
Landed in fe2a7f0 |
|
This does not land cleanly on v14.x, should it be backported? |
Fixes: nodejs#28250 PR-URL: nodejs#34398 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Fixes: #28250
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes