]> Cypherpunks repositories - gostls13.git/commit
archive/tar: properly format GNU base-256 encoding
authorJoe Tsai <joetsai@digital-static.net>
Wed, 2 Dec 2015 23:48:06 +0000 (15:48 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 4 Dec 2015 21:38:38 +0000 (21:38 +0000)
commit481eedce62015f9f7ed390bb01b1afc63300b0e6
tree39458eef8871b5cef8a254e3388c86abc79fc5bf
parente71d64012c9d9dc744bc9a780b4afccd8f5b029d
archive/tar: properly format GNU base-256 encoding

Motivation:
* Previous implementation silently failed when an integer overflow
occurred. Now, we report an ErrFieldTooLong.
* Previous implementation did not encode in two's complement format and was
unable to encode negative numbers.

The relevant GNU specification says:
<<<
GNU format uses two's-complement base-256 notation to store values
that do not fit into standard ustar range.
>>>

Fixes #12436

Change-Id: I09c20602eabf8ae3a7e0db35b79440a64bfaf807
Reviewed-on: https://go-review.googlesource.com/17425
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/archive/tar/writer.go
src/archive/tar/writer_test.go