@solana/codecs-core 6.3.1 → 6.3.2-canary-20260313143218

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,7 @@ function padBytes(bytes, length) {
28
28
  }
29
29
  var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
30
30
  function containsBytes(data, bytes, offset) {
31
- const slice = offset === 0 && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length);
31
+ const slice = (offset === 0 || offset <= -data.byteLength) && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length);
32
32
  return bytesEqual(slice, bytes);
33
33
  }
34
34
  function bytesEqual(bytes1, bytes2) {
@@ -136,7 +136,7 @@ function addEncoderSentinel(encoder, sentinel) {
136
136
  }
137
137
  function addDecoderSentinel(decoder, sentinel) {
138
138
  const read = ((bytes, offset) => {
139
- const candidateBytes = offset === 0 ? bytes : bytes.slice(offset);
139
+ const candidateBytes = offset === 0 || offset <= -bytes.byteLength ? bytes : bytes.slice(offset);
140
140
  const sentinelIndex = findSentinelIndex(candidateBytes, sentinel);
141
141
  if (sentinelIndex === -1) {
142
142
  throw new SolanaError(SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES, {