Skip to content

🎥 Make videos programmatically with React

Prevent infinite loop in Rust <> Node communication

Jonny Burger7181ae36b846
diff --git a/packages/docs/src/components/TemplateModalContent.tsx b/packages/docs/src/components/TemplateModalContent.tsx
index 5eaf3a8e2e..4de3e1063b 100644
--- a/packages/docs/src/components/TemplateModalContent.tsx
+++ b/packages/docs/src/components/TemplateModalContent.tsx
@@ -101,7 +101,7 @@ const separator: React.CSSProperties = {
marginRight: 10,
};
-let copyTimeout: NodeJS.Timeout | null = null;
+let copyTimeout: Timer | null = null;
export const TemplateModalContent: React.FC<{
readonly template: Template;
diff --git a/packages/renderer/src/compositor/compositor.ts b/packages/renderer/src/compositor/compositor.ts
index 8d4700c967..54388e4c0f 100644
--- a/packages/renderer/src/compositor/compositor.ts
+++ b/packages/renderer/src/compositor/compositor.ts
@@ -173,6 +173,9 @@ export const startCompositor = <T extends keyof CompositorCommand>({
}
separatorIndex++;
+ if (separatorIndex > outputBuffer.length) {
+ throw new Error('separatorIndex out of bounds');
+ }
nonceString += String.fromCharCode(nextDigit);
}
@@ -186,6 +189,9 @@ export const startCompositor = <T extends keyof CompositorCommand>({
}
separatorIndex++;
+ if (separatorIndex > outputBuffer.length) {
+ throw new Error('separatorIndex out of bounds');
+ }
lengthString += String.fromCharCode(nextDigit);
}
@@ -199,6 +205,10 @@ export const startCompositor = <T extends keyof CompositorCommand>({
separatorIndex++;
+ if (separatorIndex > outputBuffer.length) {
+ throw new Error('separatorIndex out of bounds');
+ }
+
statusString += String.fromCharCode(nextDigit);
}
@@ -224,6 +234,7 @@ export const startCompositor = <T extends keyof CompositorCommand>({
outputBuffer = outputBuffer.subarray(
separatorIndex + Number(lengthString) + 1,
);
+
processInput();
};
@@ -245,6 +256,7 @@ export const startCompositor = <T extends keyof CompositorCommand>({
unprocessedBuffers.unshift(outputBuffer);
outputBuffer = Buffer.concat(unprocessedBuffers);
+
unprocessedBuffers = [];
processInput();
});