Skip to content

Commit 7bb9d1b

Browse files
committed
fixup! fix: producer must not replace placeholder in source string
1 parent 86772ab commit 7bb9d1b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/producer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function discoverPlaceholder(
4747
}
4848

4949
/**
50-
* the PAYLOAD/PRELUDE placeholders occur twice in the binaries:
50+
* the PAYLOAD/PRELUDE placeholders can occur twice in the binaries:
5151
* - in source text as a string literal
5252
* - in bytecode as a raw string
5353
* the ordering depends on the platform - we need to make sure that
@@ -57,12 +57,15 @@ function discoverPlaceholder(
5757
* also see: https://github.com/yao-pkg/pkg/pull/86
5858
*/
5959
if (binaryBuffer[position - 1] === 39 /* ascii for ' APOSTROPHE */) {
60-
return discoverPlaceholder(
60+
const nextPlaceholder = discoverPlaceholder(
6161
binaryBuffer,
6262
searchString,
6363
padder,
6464
position + placeholder.length,
6565
);
66+
if (!('notFound' in nextPlaceholder)) {
67+
return nextPlaceholder;
68+
}
6669
}
6770

6871
return { position, size: placeholder.length, padder };

0 commit comments

Comments
 (0)