You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
I had some old code that used buf.fill(null) for clearing up buffer contents. Looking at the docs I don't see it mentioned anywhere so I'm not sure if this is something I just came up or picked up from some sample code.
Anyway this used to work in v0.8 and v0.10 but doesn't work in v0.11. I bisected it to this change 4b40358 and because the commit message only mentions strings, I think the null behavior change may be unintentional.
So its something that is not documented/supported but has a potential to break old code.
Do you think this is worth to change the behavior to match old versions. Or should the function return an error for such input?
Thanks for reporting this. It uncovered a critical bug where buf.fill('') (i.e. passing an empty string) causes Node to hang indefinitely. I'll have patch for this shortly.
Running fill() with an empty string would cause Node to hang
indefinitely. Now it will return without having operated on the buffer.
User facing function has been pulled into JS to perform all initial
value checks and coercions. The C++ method has been placed on the
"internal" object.
Coerced non-string values to numbers to match v0.10 support.
Simplified logic and changed a couple variable names.
Added tests for fill() and moved them all to the beginning of
buffer-test.js since many other tests depend on fill() working properly.
Fixes: #8469
Signed-off-by: Trevor Norris <[email protected]>
I had some old code that used
buf.fill(null)
for clearing up buffer contents. Looking at the docs I don't see it mentioned anywhere so I'm not sure if this is something I just came up or picked up from some sample code.Anyway this used to work in
v0.8
andv0.10
but doesn't work inv0.11
. I bisected it to this change 4b40358 and because the commit message only mentions strings, I think the null behavior change may be unintentional.So its something that is not documented/supported but has a potential to break old code.
Do you think this is worth to change the behavior to match old versions. Or should the function return an error for such input?
I could probably provide a PR.
/cc @trevnorris
The text was updated successfully, but these errors were encountered: