From: Ian Lance Taylor Date: Fri, 7 Dec 2018 15:25:50 +0000 (-0800) Subject: cmd/internal/obj/s390x: don't crash on invalid instruction X-Git-Tag: go1.12beta1~139 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e546ef123e6e3a28dc7722fb6bbf1161b7024163;p=gostls13.git cmd/internal/obj/s390x: don't crash on invalid instruction I didn't bother with a test as there doesn't seem to be an existing framework for testing assembler failures, and tests for invalid code aren't all that interesting. Fixes #26700 Change-Id: I719410d83527802a09b9d38625954fdb36a3c0f7 Reviewed-on: https://go-review.googlesource.com/c/153177 Run-TryBot: Ian Lance Taylor Reviewed-by: Michael Munday TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/internal/obj/s390x/asmz.go b/src/cmd/internal/obj/s390x/asmz.go index 4e43d27790..7d49103be6 100644 --- a/src/cmd/internal/obj/s390x/asmz.go +++ b/src/cmd/internal/obj/s390x/asmz.go @@ -2618,6 +2618,10 @@ func (c *ctxtz) branchMask(p *obj.Prog) uint32 { func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) { o := c.oplook(p) + if o == nil { + return + } + switch o.type_ { default: c.ctxt.Diag("unknown type %d", o.type_)