MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxIsDataViewOutOfBound

Function fxIsDataViewOutOfBound

xs/sources/xsDataView.c:898–914  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

896}
897
898txBoolean fxIsDataViewOutOfBound(txMachine* the, txSlot* view, txSlot* buffer)
899{
900 txInteger size = view->value.dataView.size;
901 txSlot* arrayBuffer = buffer->value.reference->next;
902 txSlot* bufferInfo = arrayBuffer->next;
903 if (arrayBuffer->value.arrayBuffer.address == C_NULL)
904 return 1;
905 if (bufferInfo->value.bufferInfo.maxLength >= 0) {
906 txInteger offset = view->value.dataView.offset;
907 txInteger byteLength = bufferInfo->value.bufferInfo.length;
908 if (offset > byteLength)
909 return 1;
910 if ((size > 0) && (offset + size > byteLength))
911 return 1;
912 }
913 return 0;
914}
915
916txSlot* fxNewDataViewInstance(txMachine* the)
917{

Callers 3

fxGetArrayLimitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected