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
Hello! I got this error while working with sockets implementing a low-level protocol:
error: Uncaught InvalidInput: no buffer specified
► $deno$/dispatch_minimal.ts:64:11
at DenoError ($deno$/errors.ts:20:5)
at unwrapResponse ($deno$/dispatch_minimal.ts:64:11)
at sendAsyncMinimal ($deno$/dispatch_minimal.ts:106:10)
Turns out core’s implementation of Deno.Conn.read seems to have undefined behaviour when the buffer has no size.
Here’s an example to reproduce the error:
Giving a size other than 0 to the client’s rdbuf makes this piece of code work as expected.
Some solutions:
Make it explicit in the JSDoc that p.length must be greater than 0.
Mimic POSIX read behaviour: In the absence of any errors, or if read() does not check for errors, a read() with a count of 0 returns zero and has no other effects. (from the manpage). This requires adding a check to the following function (and readSync), and writing tests.
Hello! I got this error while working with sockets implementing a low-level protocol:
Turns out core’s implementation of
Deno.Conn.read
seems to have undefined behaviour when the buffer has no size.Here’s an example to reproduce the error:
Giving a size other than 0 to the client’s
rdbuf
makes this piece of code work as expected.Some solutions:
p.length
must be greater than 0.read
behaviour:In the absence of any errors, or if read() does not check for errors, a read() with a count of 0 returns zero and has no other effects.
(from the manpage). This requires adding a check to the following function (andreadSync
), and writing tests.deno/cli/js/files.ts
Lines 76 to 85 in 6c5a981
If you’re ok with the second solution, I can do the PR :)
I’m using Deno v0.22.0.
The text was updated successfully, but these errors were encountered: