@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.
@@ -30,7 +30,7 @@ function padBytes(bytes, length) {
30
30
  }
31
31
  var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
32
32
  function containsBytes(data, bytes, offset) {
33
- const slice = offset === 0 && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length);
33
+ const slice = (offset === 0 || offset <= -data.byteLength) && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length);
34
34
  return bytesEqual(slice, bytes);
35
35
  }
36
36
  function bytesEqual(bytes1, bytes2) {
@@ -138,7 +138,7 @@ function addEncoderSentinel(encoder, sentinel) {
138
138
  }
139
139
  function addDecoderSentinel(decoder, sentinel) {
140
140
  const read = ((bytes, offset) => {
141
- const candidateBytes = offset === 0 ? bytes : bytes.slice(offset);
141
+ const candidateBytes = offset === 0 || offset <= -bytes.byteLength ? bytes : bytes.slice(offset);
142
142
  const sentinelIndex = findSentinelIndex(candidateBytes, sentinel);
143
143
  if (sentinelIndex === -1) {
144
144
  throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES, {