• Joe Tsai's avatar
    archive/tar: properly format GNU base-256 encoding · 481eedce
    Joe Tsai authored
    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/17425Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    481eedce
writer.go 11.9 KB