MCPcopy
hub / github.com/mongodb/node-mongodb-native / validateBufferInputs

Function validateBufferInputs

src/bson.ts:43–49  ·  view source on GitHub ↗
(buffer: Uint8Array, offset: number, length: number)

Source from the content-addressed store, hash-verified

41
42// validates buffer inputs, used for read operations
43const validateBufferInputs = (buffer: Uint8Array, offset: number, length: number) => {
44 if (offset < 0 || offset + length > buffer.length) {
45 throw new RangeError(
46 `Attempt to access memory outside buffer bounds: buffer length: ${buffer.length}, offset: ${offset}, length: ${length}`
47 );
48 }
49};
50
51// readInt32LE, reads a 32-bit integer from buffer at given offset
52// throws if offset is out of bounds

Callers 2

readInt32LEFunction · 0.85
readUint8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected