<p dir="auto">The following program crashes with a panic:</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main

import (
    &quot;archive/tar&quot;
    &quot;bytes&quot;
    &quot;io&quot;
    &quot;io/ioutil&quot;
)

func main() {
    data := []byte(&quot;\x13\x0300\x13\x03-821950296t\x13\x13\x83&quot; +
        &quot;s|\x83s\x1300qw\xe1f\xbb\x03000\x00\x00\x00\x10&quot; +
        &quot;011\x13s\xf410100t\x13\x13\x83s|\x83ss&quot; +
        &quot;\x000\x13s|\x83ss\xf4xS\x13s\xf410100t&quot; +
        &quot;\x13\x13\x83s|\x83ss\xf40\x13s|\x83ss\xf4qS0&quot; +
        &quot;\xd4t0\x1300q0\xf40\x00\x00\x00\x1001\x80\x00\x100&quot; +
        &quot;11\x13s\xf4101\xf40t\x1300q\xd4\xe1f\xbb\x03&quot; +
        &quot;\x00\x00\x00\xff\x80\x80\x80\x00\x80\x00\x00\x00\x00\x00\x9b\x92x\x13\xff\xff&quot; +
        &quot;\xff\x80100txS00t0\x1300qw010&quot; +
        &quot;100t\x13\x13\x83s|\x83ss\xf4xS00t0\x13&quot; +
        &quot;00qw\xe1f\xbb\x03000\x00\x00\x00\x10011\x13s&quot; +
        &quot;\xf410100t\x13\x13\x83s|\x83ss\xf40\x13s|&quot; +
        &quot;\x83ss\xf4xS\x13s\xf410100t\x13\x13\x83s|&quot; +
        &quot;\x83ss00\x13s|\x83ss\xf4xS00t0\x130&quot; +
        &quot;0q00\x00\x80\x00\x00\x1001s\xf410100t\x13&quot; +
        &quot;\x00\x00\x00 \xe1f\xbb\x0304\x00\x00\x00\x10011\x13\xff\xff&quot; +
        &quot;\xff\x80100txS00t0\x1300qw\xe1f\xbb&quot; +
        &quot;\x03000\x00\x00\x00\x10011\x13s\x83ss\xf4xS\x13&quot; +
        &quot;s\xf410100t\x13\x13\x83s|\x83ss\xf4311&quot; +
        &quot;033624846128380s|\x83ss&quot; +
        &quot;\xf41S00t0\x1300q000\x00\x00\x00\x1001&quot; +
        &quot;\x00\x00\x10011\x13s\xf410100t\x1300q\xd4&quot; +
        &quot;\xe1f\xbb\x0304\x00\x00\x00\x10\x83s|\x83ss\xf40\x13s&quot; +
        &quot;|\x83ss0xS00t0\x1300q000\x00\x00&quot; +
        &quot;\x00\x1001\x00\x00\x10011\x13s\xf410100t\x13&quot; +
        &quot;00x0\xe1f\xbb\x03\x00\x00\x100&quot;)
    t := tar.NewReader(bytes.NewReader(data))
    for {
        _, err := t.Next()
        if err != nil {
            return
        }
        io.Copy(ioutil.Discard, t)
    }
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-k">import</span> (
    <span class="pl-s">"archive/tar"</span>
    <span class="pl-s">"bytes"</span>
    <span class="pl-s">"io"</span>
    <span class="pl-s">"io/ioutil"</span>
)

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-s1">data</span> <span class="pl-c1">:=</span> []<span class="pl-smi">byte</span>(<span class="pl-s">"<span class="pl-cce">\x13</span><span class="pl-cce">\x03</span>00<span class="pl-cce">\x13</span><span class="pl-cce">\x03</span>-821950296t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"s|<span class="pl-cce">\x83</span>s<span class="pl-cce">\x13</span>00qw<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"011<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span>0<span class="pl-cce">\x13</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>0<span class="pl-cce">\x13</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>qS0"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xd4</span>t0<span class="pl-cce">\x13</span>00q0<span class="pl-cce">\xf4</span>0<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>01<span class="pl-cce">\x80</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>0"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"11<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>101<span class="pl-cce">\xf4</span>0t<span class="pl-cce">\x13</span>00q<span class="pl-cce">\xd4</span><span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\xff</span><span class="pl-cce">\x80</span><span class="pl-cce">\x80</span><span class="pl-cce">\x80</span><span class="pl-cce">\x00</span><span class="pl-cce">\x80</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x9b</span><span class="pl-cce">\x92</span>x<span class="pl-cce">\x13</span><span class="pl-cce">\xff</span><span class="pl-cce">\xff</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xff</span><span class="pl-cce">\x80</span>100txS00t0<span class="pl-cce">\x13</span>00qw010"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS00t0<span class="pl-cce">\x13</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"00qw<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span>s"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>0<span class="pl-cce">\x13</span>s|"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x83</span>ss00<span class="pl-cce">\x13</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS00t0<span class="pl-cce">\x13</span>0"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"0q00<span class="pl-cce">\x00</span><span class="pl-cce">\x80</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>01s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span> <span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>04<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span><span class="pl-cce">\xff</span><span class="pl-cce">\xff</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xff</span><span class="pl-cce">\x80</span>100txS00t0<span class="pl-cce">\x13</span>00qw<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x03</span>000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span>s<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS<span class="pl-cce">\x13</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>311"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"033624846128380s|<span class="pl-cce">\x83</span>ss"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xf4</span>1S00t0<span class="pl-cce">\x13</span>00q000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>01"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span>00q<span class="pl-cce">\xd4</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>04<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>0<span class="pl-cce">\x13</span>s"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"|<span class="pl-cce">\x83</span>ss0xS00t0<span class="pl-cce">\x13</span>00q000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>01<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"00x0<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>0"</span>)
    <span class="pl-s1">t</span> <span class="pl-c1">:=</span> <span class="pl-s1">tar</span>.<span class="pl-en">NewReader</span>(<span class="pl-s1">bytes</span>.<span class="pl-en">NewReader</span>(<span class="pl-s1">data</span>))
    <span class="pl-k">for</span> {
        <span class="pl-s1">_</span>, <span class="pl-s1">err</span> <span class="pl-c1">:=</span> <span class="pl-s1">t</span>.<span class="pl-en">Next</span>()
        <span class="pl-k">if</span> <span class="pl-s1">err</span> <span class="pl-c1">!=</span> <span class="pl-c1">nil</span> {
            <span class="pl-k">return</span>
        }
        <span class="pl-s1">io</span>.<span class="pl-en">Copy</span>(<span class="pl-s1">ioutil</span>.<span class="pl-c1">Discard</span>, <span class="pl-s1">t</span>)
    }
}</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="panic: runtime error: slice bounds out of range [recovered]
    panic: runtime error: slice bounds out of range

goroutine 1 [running]:
io/ioutil.readAll.func1(0xc208041c58)
    src/io/ioutil/ioutil.go:30 +0x121
archive/tar.(*regFileReader).Read(0xc20800e420, 0xc20806e400, 0x200, 0x200, 0xc208070139, 0x0, 0x0)
    src/archive/tar/reader.go:748 +0x170
archive/tar.(*Reader).Read(0xc208070000, 0xc20806e400, 0x200, 0x200, 0x200, 0x0, 0x0)
    src/archive/tar/reader.go:735 +0x9d
bytes.(*Buffer).ReadFrom(0xc208041bb0, 0x7f7a1683f268, 0xc208070000, 0x0, 0x0, 0x0)
    src/bytes/buffer.go:173 +0x242
io/ioutil.readAll(0x7f7a1683f268, 0xc208070000, 0x200, 0x0, 0x0, 0x0, 0x0, 0x0)
    src/io/ioutil/ioutil.go:33 +0x157
io/ioutil.ReadAll(0x7f7a1683f268, 0xc208070000, 0x0, 0x0, 0x0, 0x0, 0x0)
    src/io/ioutil/ioutil.go:42 +0x58
archive/tar.parsePAX(0x7f7a1683f268, 0xc208070000, 0x5edc78, 0x0, 0x0)
    src/archive/tar/reader.go:314 +0x55
archive/tar.(*Reader).Next(0xc208070000, 0xc208070000, 0x0, 0x0)
    src/archive/tar/reader.go:106 +0x4a2
main.main()
    tar.go:39 +0x170"><pre class="notranslate"><code class="notranslate">panic: runtime error: slice bounds out of range [recovered]
    panic: runtime error: slice bounds out of range

goroutine 1 [running]:
io/ioutil.readAll.func1(0xc208041c58)
    src/io/ioutil/ioutil.go:30 +0x121
archive/tar.(*regFileReader).Read(0xc20800e420, 0xc20806e400, 0x200, 0x200, 0xc208070139, 0x0, 0x0)
    src/archive/tar/reader.go:748 +0x170
archive/tar.(*Reader).Read(0xc208070000, 0xc20806e400, 0x200, 0x200, 0x200, 0x0, 0x0)
    src/archive/tar/reader.go:735 +0x9d
bytes.(*Buffer).ReadFrom(0xc208041bb0, 0x7f7a1683f268, 0xc208070000, 0x0, 0x0, 0x0)
    src/bytes/buffer.go:173 +0x242
io/ioutil.readAll(0x7f7a1683f268, 0xc208070000, 0x200, 0x0, 0x0, 0x0, 0x0, 0x0)
    src/io/ioutil/ioutil.go:33 +0x157
io/ioutil.ReadAll(0x7f7a1683f268, 0xc208070000, 0x0, 0x0, 0x0, 0x0, 0x0)
    src/io/ioutil/ioutil.go:42 +0x58
archive/tar.parsePAX(0x7f7a1683f268, 0xc208070000, 0x5edc78, 0x0, 0x0)
    src/archive/tar/reader.go:314 +0x55
archive/tar.(*Reader).Next(0xc208070000, 0xc208070000, 0x0, 0x0)
    src/archive/tar/reader.go:106 +0x4a2
main.main()
    tar.go:39 +0x170
</code></pre></div>
<p dir="auto">on commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/golang/go/commit/8017ace496f5a21bcd55377e250e325f8ba11d45/hovercard" href="https://github.com/golang/go/commit/8017ace496f5a21bcd55377e250e325f8ba11d45"><tt>8017ace</tt></a></p>
<p dir="auto">The following program crashes with a panic:</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main

import (
    &quot;archive/tar&quot;
    &quot;bytes&quot;
    &quot;io&quot;
    &quot;io/ioutil&quot;
)

func main() {
    data := []byte(&quot;\x13\x0300\x13\x03-821950296t\x13\x13\x83&quot; +
        &quot;s|\x83s\x1300qw\xe1f\xbb\x03000\x00\x00\x00\x10&quot; +
        &quot;011\x13s\xf410100t\x13\x13\x83s|\x83ss&quot; +
        &quot;\x000\x13s|\x83ss\xf4xS\x13s\xf410100t&quot; +
        &quot;\x13\x13\x83s|\x83ss\xf40\x13s|\x83ss\xf4qS0&quot; +
        &quot;\xd4t0\x1300q0\xf40\x00\x00\x00\x1001\x80\x00\x100&quot; +
        &quot;11\x13s\xf4101\xf40t\x1300q\xd4\xe1f\xbb\x03&quot; +
        &quot;\x00\x00\x00\xff\x80\x80\x80\x00\x80\x00\x00\x00\x00\x00\x9b\x921\x13\xff\xff&quot; +
        &quot;\xff\x80100txS00t0\x1300qw010&quot; +
        &quot;100t\x13\x13\x83s|\x83ss\xf4xS00t0\x13&quot; +
        &quot;00qw\xe1f\xbb\x03000\x00\x00\x00\x10011\x13s&quot; +
        &quot;\xf410100t\x13\x13\x83s|\x83ss\xf40\x13s|&quot; +
        &quot;\x83ss\xf4xS\x13s\xf410100t\x13\x13\x83s|&quot; +
        &quot;\x83ss00\x13s|\x83ss0xS00t0\x130&quot; +
        &quot;0q00\x00\x80\x00\x00\x1001s\xf410100t\x13&quot; +
        &quot;\x00\x00\x00 \xe1f\xbb\x0304\x00\x00\x00\x10011\x13\xff\xff&quot; +
        &quot;\xff\x80100txS00t0\x1300qw\xe1f\xbb&quot; +
        &quot;\x03000\x00\x00\x00\x10011\x13s\x83ss\xf4xS\x13&quot; +
        &quot;s\xf410100t\x13\x13\x83s|\x83ss\xf4311&quot; +
        &quot;033624846128380s|\x83ss&quot; +
        &quot;\xf4xS00t0\x1300q000\x00\x00\x00\x1001&quot; +
        &quot;\x00\x00\x10011\x13s\xf410100t\x1300q\xd4&quot; +
        &quot;\xe1f\xbb\x0304\x00\x00\x00\x10\x83s|\x83ss\xf40\x13s&quot; +
        &quot;|\x83ss\xf4xS00t0\x1300q000\x00\x00&quot; +
        &quot;\x00\x1001\x00\x00\x10011\x13s\xf410100t\x13&quot; +
        &quot;00x0\xe1f\xbb\x03\x00\x00\x100&quot;)
    t := tar.NewReader(bytes.NewReader(data))
    for {
        _, err := t.Next()
        if err != nil {
            return
        }
        io.Copy(ioutil.Discard, t)
    }
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-k">import</span> (
    <span class="pl-s">"archive/tar"</span>
    <span class="pl-s">"bytes"</span>
    <span class="pl-s">"io"</span>
    <span class="pl-s">"io/ioutil"</span>
)

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-s1">data</span> <span class="pl-c1">:=</span> []<span class="pl-smi">byte</span>(<span class="pl-s">"<span class="pl-cce">\x13</span><span class="pl-cce">\x03</span>00<span class="pl-cce">\x13</span><span class="pl-cce">\x03</span>-821950296t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"s|<span class="pl-cce">\x83</span>s<span class="pl-cce">\x13</span>00qw<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"011<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span>0<span class="pl-cce">\x13</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>0<span class="pl-cce">\x13</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>qS0"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xd4</span>t0<span class="pl-cce">\x13</span>00q0<span class="pl-cce">\xf4</span>0<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>01<span class="pl-cce">\x80</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>0"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"11<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>101<span class="pl-cce">\xf4</span>0t<span class="pl-cce">\x13</span>00q<span class="pl-cce">\xd4</span><span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\xff</span><span class="pl-cce">\x80</span><span class="pl-cce">\x80</span><span class="pl-cce">\x80</span><span class="pl-cce">\x00</span><span class="pl-cce">\x80</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x9b</span><span class="pl-cce">\x92</span>1<span class="pl-cce">\x13</span><span class="pl-cce">\xff</span><span class="pl-cce">\xff</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xff</span><span class="pl-cce">\x80</span>100txS00t0<span class="pl-cce">\x13</span>00qw010"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS00t0<span class="pl-cce">\x13</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"00qw<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span>s"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>0<span class="pl-cce">\x13</span>s|"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x83</span>ss00<span class="pl-cce">\x13</span>s|<span class="pl-cce">\x83</span>ss0xS00t0<span class="pl-cce">\x13</span>0"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"0q00<span class="pl-cce">\x00</span><span class="pl-cce">\x80</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>01s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span> <span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>04<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span><span class="pl-cce">\xff</span><span class="pl-cce">\xff</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xff</span><span class="pl-cce">\x80</span>100txS00t0<span class="pl-cce">\x13</span>00qw<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x03</span>000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span>s<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS<span class="pl-cce">\x13</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span><span class="pl-cce">\x13</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>311"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"033624846128380s|<span class="pl-cce">\x83</span>ss"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xf4</span>xS00t0<span class="pl-cce">\x13</span>00q000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>01"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span>00q<span class="pl-cce">\xd4</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span>04<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span><span class="pl-cce">\x83</span>s|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>0<span class="pl-cce">\x13</span>s"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"|<span class="pl-cce">\x83</span>ss<span class="pl-cce">\xf4</span>xS00t0<span class="pl-cce">\x13</span>00q000<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"<span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>01<span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>011<span class="pl-cce">\x13</span>s<span class="pl-cce">\xf4</span>10100t<span class="pl-cce">\x13</span>"</span> <span class="pl-c1">+</span>
        <span class="pl-s">"00x0<span class="pl-cce">\xe1</span>f<span class="pl-cce">\xbb</span><span class="pl-cce">\x03</span><span class="pl-cce">\x00</span><span class="pl-cce">\x00</span><span class="pl-cce">\x10</span>0"</span>)
    <span class="pl-s1">t</span> <span class="pl-c1">:=</span> <span class="pl-s1">tar</span>.<span class="pl-en">NewReader</span>(<span class="pl-s1">bytes</span>.<span class="pl-en">NewReader</span>(<span class="pl-s1">data</span>))
    <span class="pl-k">for</span> {
        <span class="pl-s1">_</span>, <span class="pl-s1">err</span> <span class="pl-c1">:=</span> <span class="pl-s1">t</span>.<span class="pl-en">Next</span>()
        <span class="pl-k">if</span> <span class="pl-s1">err</span> <span class="pl-c1">!=</span> <span class="pl-c1">nil</span> {
            <span class="pl-k">return</span>
        }
        <span class="pl-s1">io</span>.<span class="pl-en">Copy</span>(<span class="pl-s1">ioutil</span>.<span class="pl-c1">Discard</span>, <span class="pl-s1">t</span>)
    }
}</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="panic: runtime error: slice bounds out of range

goroutine 1 [running]:
archive/tar.(*regFileReader).Read(0xc20800e420, 0xc208074000, 0x2000, 0x2000, 0x0, 0x0, 0x0)
    src/archive/tar/reader.go:748 +0x170
archive/tar.(*Reader).Read(0xc208070000, 0xc208074000, 0x2000, 0x2000, 0x4feab0, 0x0, 0x0)
    src/archive/tar/reader.go:735 +0x9d
io/ioutil.devNull.ReadFrom(0x0, 0x7feaee410268, 0xc208070000, 0x0, 0x0, 0x0)
    src/io/ioutil/ioutil.go:151 +0xa1
io/ioutil.(*devNull).ReadFrom(0xc20800a4a0, 0x7feaee410268, 0xc208070000, 0xc208041e40, 0x0, 0x0)
    &lt;autogenerated&gt;:9 +0xb4
io.copyBuffer(0x7feaee4101c0, 0xc20800a4a0, 0x7feaee410268, 0xc208070000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    src/io/io.go:375 +0x183
io.Copy(0x7feaee4101c0, 0xc20800a4a0, 0x7feaee410268, 0xc208070000, 0x200, 0x0, 0x0)
    src/io/io.go:351 +0x6b
main.main()
    tar.go:43 +0x1df"><pre class="notranslate"><code class="notranslate">panic: runtime error: slice bounds out of range

goroutine 1 [running]:
archive/tar.(*regFileReader).Read(0xc20800e420, 0xc208074000, 0x2000, 0x2000, 0x0, 0x0, 0x0)
    src/archive/tar/reader.go:748 +0x170
archive/tar.(*Reader).Read(0xc208070000, 0xc208074000, 0x2000, 0x2000, 0x4feab0, 0x0, 0x0)
    src/archive/tar/reader.go:735 +0x9d
io/ioutil.devNull.ReadFrom(0x0, 0x7feaee410268, 0xc208070000, 0x0, 0x0, 0x0)
    src/io/ioutil/ioutil.go:151 +0xa1
io/ioutil.(*devNull).ReadFrom(0xc20800a4a0, 0x7feaee410268, 0xc208070000, 0xc208041e40, 0x0, 0x0)
    &lt;autogenerated&gt;:9 +0xb4
io.copyBuffer(0x7feaee4101c0, 0xc20800a4a0, 0x7feaee410268, 0xc208070000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    src/io/io.go:375 +0x183
io.Copy(0x7feaee4101c0, 0xc20800a4a0, 0x7feaee410268, 0xc208070000, 0x200, 0x0, 0x0)
    src/io/io.go:351 +0x6b
main.main()
    tar.go:43 +0x1df
</code></pre></div>
<p dir="auto">on commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/golang/go/commit/8017ace496f5a21bcd55377e250e325f8ba11d45/hovercard" href="https://github.com/golang/go/commit/8017ace496f5a21bcd55377e250e325f8ba11d45"><tt>8017ace</tt></a></p>