mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 21:23:45 +00:00
fix(elf): reject invalid section table and zlib declarations (#12193)
* fix(elf): reject invalid section table and zlib declarations Refs #10149, #10148, #9330. Co-authored-by: Nianze Wu <wunianze666@gmail.com> * fix(elf): share section count admission with carrier readers (#12196) fix(elf): admit section tables before carrier recognition --------- Co-authored-by: Nianze Wu <wunianze666@gmail.com>
This commit is contained in:
1 parent
31be73e498
commit
45768a2e81
21 files changed
+258
-61
No files matched your search
@@ -0,0 +1,23 @@
|
||||
/** Parse Node's info:true codec result, absent from the pinned @types/node overloads. */
|
||||
export const nodeCodecResult = (
|
||||
value: unknown,
|
||||
): {
|
||||
readonly buffer: Buffer;
|
||||
readonly consumedBytes: number;
|
||||
} => {
|
||||
if (
|
||||
typeof value !== "object" ||
|
||||
value === null ||
|
||||
!("buffer" in value) ||
|
||||
!Buffer.isBuffer(value.buffer) ||
|
||||
!("engine" in value) ||
|
||||
typeof value.engine !== "object" ||
|
||||
value.engine === null ||
|
||||
!("bytesWritten" in value.engine) ||
|
||||
typeof value.engine.bytesWritten !== "number"
|
||||
)
|
||||
throw new Error(
|
||||
"Built-in decoder omitted its buffer or consumed-input accounting",
|
||||
);
|
||||
return { buffer: value.buffer, consumedBytes: value.engine.bytesWritten };
|
||||
};
|
||||
Reference in new issue
Block a user