Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compress/lzw: unaligned memory access on arm #4396

davecheney opened this issue Nov 16, 2012 · 3 comments

compress/lzw: unaligned memory access on arm #4396

davecheney opened this issue Nov 16, 2012 · 3 comments


Copy link

What steps will reproduce the problem?

dfc@qnap:~/go/src$ go test compress/lzw
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0x7 code=0x1 addr=0x0 pc=0x42d18]

goroutine 3 [running]:
testing.func·003(0xb6dbafd4, 0xb6dba100)
        /home/dfc/go/src/pkg/testing/testing.go:296 +0x158
----- stack segment boundary -----
compress/lzw.(*decoder).decode(0x10664000, 0x5e7f8)
        /home/dfc/go/src/pkg/compress/lzw/reader.go:144 +0x150
compress/lzw.(*decoder).Read(0x10664000, 0x10663000, 0x200, 0x200, 0x2, ...)
        /home/dfc/go/src/pkg/compress/lzw/reader.go:122 +0x168
bytes.(*Buffer).ReadFrom(0x10644d20, 0x10631960, 0x10664000, 0x0, 0x0, ...)
        /home/dfc/go/src/pkg/bytes/buffer.go:166 +0x210
io.Copy(0x10631940, 0x10644d20, 0x10631960, 0x10664000, 0x0, ...)
        /home/dfc/go/src/pkg/io/io.go:357 +0xa4
compress/lzw.TestReader(0x10644cc0, 0xe)
        /home/dfc/go/src/pkg/compress/lzw/reader_test.go:100 +0x358
testing.tRunner(0x10644cc0, 0x19c420, 0x0)
        /home/dfc/go/src/pkg/testing/testing.go:301 +0xa8
created by testing.RunTests
        /home/dfc/go/src/pkg/testing/testing.go:377 +0x6cc

goroutine 1 [chan receive]:
testing.RunTests(0x10c00, 0x19c420, 0x3, 0x3, 0x1, ...)
        /home/dfc/go/src/pkg/testing/testing.go:378 +0x6ec
testing.Main(0x10c00, 0x19c420, 0x3, 0x3, 0x19c640, ...)
        /home/dfc/go/src/pkg/testing/testing.go:313 +0x68
        compress/lzw/_test/_testmain.go:59 +0x94

goroutine 2 [syscall]:
created by runtime.main
FAIL    compress/lzw    0.037s
dfc@qnap:~/go/src$ dmesg | tail -n 1
[ 2224.439899] Alignment trap: lzw.test (6520) PC=0x00042d18 Instr=0xe5912000
Address=0x1066702e FSR 0x001

What is the expected output? What do you see instead?


Please use labels and text to provide additional information.

This host was configured to kill the process on unaligned memory access. Previously the
test passes if unaligned memory accesses are ignored.
Copy link
Contributor Author

Comment 1:

I believe this is a padding issue in 5g. 
diff -r dbf92f38bae0 src/pkg/compress/lzw/reader.go
--- a/src/pkg/compress/lzw/reader.go    Fri Nov 16 17:24:43 2012 -0800
+++ b/src/pkg/compress/lzw/reader.go    Sat Nov 17 21:26:48 2012 +1100
@@ -55,7 +55,7 @@
        // with the upper bound incrementing on each code seen.
        // overflow is the code at which hi overflows the code width.
        // last is the most recently seen code, or decoderInvalidCode.
-       clear, eof, hi, overflow, last uint16
+       clear, eof, hi, overflow, last, _ uint16
        // Each code c in [lo, hi] expands to two or more bytes. For c != hi:
        //   suffix[c] is the last of these bytes.
Fixes the problem.

Copy link
Contributor Author

Comment 2:

Status changed to Started.

Copy link
Contributor Author

Comment 3:

This issue was closed by revision 54e8d50.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

3 participants