Re: [webrtc-rtptransport] Add byte length fields for BYOB methods (#63)

> Does `copyPayloadTo(destination)` protect against buffer overflows? For example, does it check the destination buffer length and throw if it isn't big enough? Or does it copy only the portion that will fit?

I like the "check and throw" approach, so adopting the [WebCodecs copyTo algo step](https://www.w3.org/TR/webcodecs/#dom-encodedaudiochunk-copyto): "If the [[[byte length]]](https://www.w3.org/TR/webcodecs/#dom-encodedaudiochunk-byte-length-slot) of this [EncodedAudioChunk](https://www.w3.org/TR/webcodecs/#encodedaudiochunk) is greater than in destination, throw a [TypeError](https://webidl.spec.whatwg.org/#exceptiondef-typeerror).".

I've added that to the api-outline.md comment.

-- 
GitHub Notification of comment by tonyherre
Please view or discuss this issue at https://github.com/w3c/webrtc-rtptransport/pull/63#issuecomment-2264785691 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 2 August 2024 07:50:23 UTC