Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: src/platform/vboot_reference/vboot_firmware/lib/include/stateful_util.h

Issue 2327001: VerifyKernelHeader() fills a KernelImage* (Closed) Base URL: ssh://gitrw.chromium.org/chromiumos
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/vboot_reference/vboot_firmware/lib/include/stateful_util.h
diff --git a/src/platform/vboot_reference/vboot_firmware/lib/include/stateful_util.h b/src/platform/vboot_reference/vboot_firmware/lib/include/stateful_util.h
index f8ad2dde2f017ab0d5eee1ee78b2116df3d2578b..246aeabb63408f3dc42fde9014d4f8b2c052d6b5 100644
--- a/src/platform/vboot_reference/vboot_firmware/lib/include/stateful_util.h
+++ b/src/platform/vboot_reference/vboot_firmware/lib/include/stateful_util.h
@@ -22,6 +22,16 @@ typedef struct MemcpyState {
uint8_t overrun; /* Flag set to 1 when an overrun occurs. */
} MemcpyState;
+/* Skip [len] bytes only if there's enough data to skip according
+ * to [state].
+ * On success, return a meaningless but non-NULL pointer and updates [state].
+ * On failure, return NULL, set remaining_len in state to -1.
+ *
+ * Useful for iterating through a binary blob to populate a struct. After the
+ * first failure (buffer overrun), successive calls will always fail.
+ */
+void* StatefulSkip(MemcpyState* state, uint64_t len);
+
/* Copy [len] bytes into [dst] only if there's enough data to read according
* to [state].
* On success, return [dst] and update [state].

Powered by Google App Engine
This is Rietveld 408576698