1. 01 Dec, 2015 12 commits
    • Russ Cox's avatar
      testing: document that T and B are safe for concurrent calls · e2071ecd
      Russ Cox authored
      Fixes #13108.
      
      Change-Id: I474cc2a3b7ced1c9eb978fc815f9c6bae9fb3ecc
      Reviewed-on: https://go-review.googlesource.com/17235Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      e2071ecd
    • Blake Gentry's avatar
      net/http: retry idempotent HTTP reqs on dead reused conns · 5dd372bd
      Blake Gentry authored
      If we try to reuse a connection that the server is in the process of
      closing, we may end up successfully writing out our request (or a
      portion of our request) only to find a connection error when we try to
      read from (or finish writing to) the socket. This manifests as an EOF
      returned from the Transport's RoundTrip.
      
      The issue, among others, is described in #4677.
      
      This change follows some of the Chromium guidelines for retrying
      idempotent requests only when the connection has been already been used
      successfully and no header data has yet been received for the response.
      
      As part of this change, an unexported error was defined for
      errMissingHost, which was previously defined inline. errMissingHost is
      the only non-network error returned from a Request's Write() method.
      
      Additionally, this breaks TestLinuxSendfile because its test server
      explicitly triggers the type of scenario this change is meant to retry
      on. Because that test server stops accepting conns on the test listener
      before the retry, the test would time out. To fix this, the test was
      altered to use a non-idempotent test type (POST).
      
      Change-Id: I1ca630b944f0ed7ec1d3d46056a50fb959481a16
      Reviewed-on: https://go-review.googlesource.com/3210Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      5dd372bd
    • David Benjamin's avatar
      encoding/asn1: Reject invalid INTEGERs. · 7c20ea93
      David Benjamin authored
      The empty string is not a valid DER integer. DER also requires that values be
      minimally-encoded, so excess padding with leading 0s (0xff for negative
      numbers) is forbidden. (These rules also apply to BER, incidentally.)
      
      Fixes #12622.
      
      Change-Id: I041f94e34a8afa29dbf94dd8fc450944bc91c9c3
      Reviewed-on: https://go-review.googlesource.com/17008Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7c20ea93
    • Joe Tsai's avatar
      archive/tar: fix issues with readGNUSparseMap1x0 · 7823197e
      Joe Tsai authored
      Motivations:
      * Use of strconv.ParseInt does not properly treat integers as 64bit,
      preventing this function from working properly on 32bit machines.
      * Use of io.ReadFull does not properly detect truncated streams
      when the file suddenly ends on a block boundary.
      * The function blindly trusts user input for numEntries and allocates
      memory accordingly.
      * The function does not validate that numEntries is not negative,
      allowing a malicious sparse file to cause a panic during make.
      
      In general, this function was overly complicated for what it was
      accomplishing and it was hard to reason that it was free from
      bounds errors. Instead, it has been rewritten and relies on
      bytes.Buffer.ReadString to do the main work. So long as invariants
      about the number of '\n' in the buffer are maintained, it is much
      easier to see why this approach is correct.
      
      Change-Id: Ibb12c4126c26e0ea460ea063cd17af68e3cf609e
      Reviewed-on: https://go-review.googlesource.com/15174Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7823197e
    • Joe Tsai's avatar
      archive/tar: properly handle header-only "files" in Reader · dd5e14a7
      Joe Tsai authored
      Certain special type-flags, specifically 1, 2, 3, 4, 5, 6,
      do not have a data section. Thus, regardless of what the size field
      says, we should not attempt to read any data for these special types.
      
      The relevant PAX and USTAR specification says:
      <<<
      If the typeflag field is set to specify a file to be of type 1 (a link)
      or 2 (a symbolic link), the size field shall be specified as zero.
      If the typeflag field is set to specify a file of type 5 (directory),
      the size field shall be interpreted as described under the definition
      of that record type. No data logical records are stored for types 1, 2, or 5.
      If the typeflag field is set to 3 (character special file),
      4 (block special file), or 6 (FIFO), the meaning of the size field is
      unspecified by this volume of POSIX.1-2008, and no data logical records shall
      be stored on the medium.
      Additionally, for type 6, the size field shall be ignored when reading.
      If the typeflag field is set to any other value, the number of logical
      records written following the header shall be (size+511)/512, ignoring
      any fraction in the result of the division.
      >>>
      
      Contrary to the specification, we do not assert that the size field
      is zero for type 1 and 2 since we liberally accept non-conforming formats.
      
      Change-Id: I666b601597cb9d7a50caa081813d90ca9cfc52ed
      Reviewed-on: https://go-review.googlesource.com/16614Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dd5e14a7
    • Russ Cox's avatar
      bufio: clarify Read docs · 829425d3
      Russ Cox authored
      Or at least make them true.
      
      Fixes #12237.
      
      Change-Id: I3c92a07233b2174c5731d6fa7fbb9ca3a97beb6b
      Reviewed-on: https://go-review.googlesource.com/17237Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      829425d3
    • Colin Cross's avatar
      archive/zip: enable overriding (de)compressors per file · 46300a05
      Colin Cross authored
      Implement setting the compression level for a zip archive by registering
      a per-Writer compressor through Writer.RegisterCompressor.  If no
      compressors are registered, fall back to the ones registered at the
      package level.  Also implements per-Reader decompressors.
      
      Fixes #8359
      
      Change-Id: I93b27c81947b0f817b42e0067aa610ff267fdb21
      Reviewed-on: https://go-review.googlesource.com/16669Reviewed-by: 's avatarJoe Tsai <joetsai@digital-static.net>
      Run-TryBot: Joe Tsai <joetsai@digital-static.net>
      Reviewed-by: 's avatarKlaus Post <klauspost@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      46300a05
    • Aleksandr Demakin's avatar
      go/types: fix race-y initialization of Struct.offsets · a4cd0a49
      Aleksandr Demakin authored
      Use sync.Once to ensure, that 'offsets' field is initialized
      once only in a threadsafe way.
      
      Fixes #12887
      
      Change-Id: I90ef929c421ccd3094339c67a39b02d8f2e47211
      Reviewed-on: https://go-review.googlesource.com/16013Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      a4cd0a49
    • Brad Fitzpatrick's avatar
      mime: let FormatMediaType format slash-less media types, to mirror ParseMediaType. · 5ff309f4
      Brad Fitzpatrick authored
      A Content-Type always has a slash (type/subtype)
      A Content-Disposition does not (e.g. "attachment" or "line").
      A "media type" is either one of those, plus optional parameters afterwards.
      
      Our ParseMediaType and FormatMediaType weren't consistent in whether
      they permitted Content-Dispositions. Now they both do.
      
      Fixes #11289
      
      Change-Id: Ia75723c9d7adb7f4de0f65482780f823cdadb5bd
      Reviewed-on: https://go-review.googlesource.com/17135Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5ff309f4
    • Brad Fitzpatrick's avatar
      mime: don't accept single-quoted strings in media type parameter values · a3f99dc4
      Brad Fitzpatrick authored
      Fix an old bug where media type parameter values could be escaped by
      either double quotes (per the spec) or single quotes (due to my bug).
      
      The original bug was introduced by me in git rev 90e4ece3
      (https://golang.org/cl/4430049) in April 2011 when adding more tests
      from http://greenbytes.de/tech/tc2231/ and misinterpreting the
      expected value of test "attwithfntokensq" and not apparently thinking
      about it enough.
      
      No known spec or existing software produces or expects single quotes
      around values. In fact, it would have be a parsing ambiguity if it
      were allowed: the string `a=', b='` could parse as two keys "a" and
      "b" both with value "'", or it could be parse as a single key "a" with
      value "', b=".
      
      Fixes #11291
      
      Change-Id: I6de58009dd47dcabb120b017245d237cb7b1e89a
      Reviewed-on: https://go-review.googlesource.com/17136Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a3f99dc4
    • Marcel van Lohuizen's avatar
      unicode/utf8: add test for FullRune · 1dae4737
      Marcel van Lohuizen authored
      Check that it now properly handles \xC0 and \xC1.
      
      Fixes #11733.
      
      Change-Id: I66cfe0d43f9d123d4c4509a3fa18b9b6380dfc39
      Reviewed-on: https://go-review.googlesource.com/17225Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      1dae4737
    • Michael Hudson-Doyle's avatar
      runtime: set r12 to sigpanic before jumping to it in sighandler · f0005230
      Michael Hudson-Doyle authored
      The ppc64le shared library ABI demands that r12 is set to a function's global
      entrypoint before jumping to the global entrypoint. Not doing so means that
      handling signals that usually panic actually crashes (and so, e.g. can't be
      recovered). Fixes several failures of "cd test; go run run.go -linkshared".
      
      Change-Id: Ia4d0da4c13efda68340d38c045a52b37c2f90796
      Reviewed-on: https://go-review.googlesource.com/17280Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      f0005230
  2. 30 Nov, 2015 7 commits
  3. 29 Nov, 2015 3 commits
  4. 28 Nov, 2015 5 commits
  5. 27 Nov, 2015 2 commits
  6. 26 Nov, 2015 8 commits
  7. 25 Nov, 2015 3 commits