Fix parsing single section CPER error
Single section CPER logs do not contain a Record Header. The check for
a valid header is now performed only if the content includes a Record
Header. Additionally, this update fixes an issue with the size
calculation for single-section logs.
Tested :
$> ./cper-generate --out single-cper.file --single-section firmware
$> ./cper-convert to-json-section single-cper.file
Change-Id: Id7efec20df3e5b53c6f90330e0770c1f682a8d87
Signed-off-by: John Chung <john.chung@arm.com>
diff --git a/cli-app/cper-convert.c b/cli-app/cper-convert.c
index 84ce618..e011ad3 100644
--- a/cli-app/cper-convert.c
+++ b/cli-app/cper-convert.c
@@ -108,7 +108,7 @@
return;
}
- if (!header_valid(fbuff, readsize)) {
+ if (!is_single_section && !header_valid(fbuff, readsize)) {
// Check if it's base64 encoded
int32_t decoded_len = 0;
UINT8 *decoded = base64_decode(fbuff, readsize, &decoded_len);