Skip to content

Commit fa8e257

Browse files
authored
Modify memory bounds check to allow empty commands (#4)
* Modify memory bounds check to allow empty commands * Update lockfile version * Lint demo/index.ts
1 parent b18263c commit fa8e257

File tree

3 files changed

+4885
-6
lines changed

3 files changed

+4885
-6
lines changed

demo/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ async function download(): Promise<void> {
379379
logWarning("Failed to clear status");
380380
}
381381

382-
let process = webdfu.write(transferSize, firmwareFile, manifestationTolerant);
382+
const process = webdfu.write(transferSize, firmwareFile, manifestationTolerant);
383383

384384
// Erase
385385
process.events.on("erase/start", () => {
@@ -413,7 +413,9 @@ async function download(): Promise<void> {
413413
.then((status) => {
414414
logInfo(`Final DFU status: state=${status.state}, status=${status.status}`);
415415
})
416-
.catch(() => {});
416+
.catch((error) => {
417+
logError(error);
418+
});
417419
});
418420

419421
process.events.on("error", (error) => {

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ export class WebDFU {
746746
}
747747

748748
this.log.warning("Using inferred start address 0x" + startAddress.toString(16));
749-
} else if (this.getDfuseSegment(startAddress) === null) {
749+
} else if (this.getDfuseSegment(startAddress) === null && data.byteLength !== 0) {
750750
throw new WebDFUError(`Start address 0x${startAddress.toString(16)} outside of memory map bounds`);
751751
}
752752

0 commit comments

Comments
 (0)