From 797cd0c6714c8aab906e74805060baf93b5dc844 Mon Sep 17 00:00:00 2001 From: setanta Date: Fri, 24 May 2019 19:35:58 +0200 Subject: [PATCH] fix elf .a archive reading, wrong octal right format --- reader.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reader.go b/reader.go index 4b82493..5895625 100644 --- a/reader.go +++ b/reader.go @@ -85,7 +85,14 @@ func (rd *Reader) octal(b []byte) int64 { i-- } - n, _ := strconv.ParseInt(string(b[3:i+1]), 8, 64) + // check if octal start with 100xxx or just 0 (seen in elf .a files) + var input []byte + if(i < 2) { + input = b[0:i] + } else { + input = b[3:i+1] + } + n, _ := strconv.ParseInt(string(input), 8, 64) return n }