summaryrefslogtreecommitdiff
path: root/libfec
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2016-01-18 20:33:43 +0000
committerSami Tolvanen <samitolvanen@google.com>2016-01-18 20:33:43 +0000
commit3c52529f5322e114983999e09689c9b93ca26eb7 (patch)
tree1f5380f547ac05e73ed6d447e07f50d78a91240f /libfec
parent9a9efec5634b318266dc823252ebde3c6f88986f (diff)
downloadextras-3c52529f5322e114983999e09689c9b93ca26eb7.tar.gz
libfec: fix back-up header validation
If the primary fec_header is invalid, correctly validate the back-up header even if it's not at the beginning of a block. Change-Id: Ida15e6eeb08f3d50d4e096897ccc814c0949e8f8
Diffstat (limited to 'libfec')
-rw-r--r--libfec/fec_open.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libfec/fec_open.cpp b/libfec/fec_open.cpp
index 1923406f..c1d4afdb 100644
--- a/libfec/fec_open.cpp
+++ b/libfec/fec_open.cpp
@@ -117,6 +117,9 @@ static int parse_ecc_header(fec_handle *f, uint64_t offset)
return -1;
}
+ /* move offset back to the beginning of the block for validating header */
+ offset -= offset % FEC_BLOCKSIZE;
+
if (header.magic != FEC_MAGIC) {
return -1;
}