mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 03:02:56 +00:00
fix(firmware): reject malformed UTF-8 producer reports
This commit is contained in:
1 parent
2b86ea9c7c
commit
4a45c14742
3 files changed
+51
-3
No files matched your search
@@ -153,7 +153,11 @@ export const readFirmwareReport = async (
|
||||
`Report exceeded ${FIRMWARE_LIMITS.reportBytes} bytes`,
|
||||
);
|
||||
try {
|
||||
const value: unknown = JSON.parse(bytes.toString("utf8"));
|
||||
const value: unknown = JSON.parse(
|
||||
new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(
|
||||
bytes,
|
||||
),
|
||||
);
|
||||
return value;
|
||||
} catch (cause: unknown) {
|
||||
throw new AnalysisOutputError(
|
||||
|
||||
Reference in new issue
Block a user