You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/12/16 19:28:20 UTC

[mynewt-artifact] branch master updated: image: During parsing, account for header padding

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-artifact.git


The following commit(s) were added to refs/heads/master by this push:
     new 8aa2163  image: During parsing, account for header padding
8aa2163 is described below

commit 8aa21637c590ab2ff09ff825e5c5a6cbf3a0a4e0
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri Dec 13 17:56:11 2019 -0800

    image: During parsing, account for header padding
    
    The ParseImage function was ignoring header padding.  For images with
    header padding, this function truncated the image.
---
 image/parse.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/image/parse.go b/image/parse.go
index c8ee3c2..0fa7647 100644
--- a/image/parse.go
+++ b/image/parse.go
@@ -208,7 +208,7 @@ func ParseImage(imgData []byte) (Image, error) {
 	}
 	offset += size
 
-	totalLen := IMAGE_HEADER_SIZE + len(body) + int(trailer.TlvTotLen)
+	totalLen := int(hdr.HdrSz) + len(body) + int(trailer.TlvTotLen)
 	if protTrailer != nil {
 		totalLen += int(protTrailer.TlvTotLen)
 	}