Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
b1ae728d
Commit
b1ae728d
authored
Dec 12, 2011
by
Ivan Krasin
Committed by
Russ Cox
Dec 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compress/flate: fix out of bounds error
Fixes #2508. R=rsc, krasin CC=golang-dev
https://golang.org/cl/5449115
parent
26089cfe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
deflate.go
src/pkg/compress/flate/deflate.go
+3
-1
deflate_test.go
src/pkg/compress/flate/deflate_test.go
+12
-0
No files found.
src/pkg/compress/flate/deflate.go
View file @
b1ae728d
...
...
@@ -319,7 +319,9 @@ Loop:
// For matches this long, we don't bother inserting each individual
// item into the table.
d
.
index
+=
d
.
length
d
.
hash
=
(
int
(
d
.
window
[
d
.
index
])
<<
hashShift
+
int
(
d
.
window
[
d
.
index
+
1
]))
if
d
.
index
<
d
.
maxInsertIndex
{
d
.
hash
=
(
int
(
d
.
window
[
d
.
index
])
<<
hashShift
+
int
(
d
.
window
[
d
.
index
+
1
]))
}
}
if
d
.
ti
==
maxFlateBlockTokens
{
// The block includes the current character
...
...
src/pkg/compress/flate/deflate_test.go
View file @
b1ae728d
...
...
@@ -318,3 +318,15 @@ func TestWriterDict(t *testing.T) {
t
.
Fatalf
(
"writer wrote %q want %q"
,
b1
.
Bytes
(),
b
.
Bytes
())
}
}
// See http://code.google.com/p/go/issues/detail?id=2508
func
TestRegression2508
(
t
*
testing
.
T
)
{
w
:=
NewWriter
(
ioutil
.
Discard
,
1
)
buf
:=
make
([]
byte
,
1024
)
for
i
:=
0
;
i
<
131072
;
i
++
{
if
_
,
err
:=
w
.
Write
(
buf
);
err
!=
nil
{
t
.
Fatalf
(
"writer failed: %v"
,
err
)
}
}
w
.
Close
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment