From 8ebab600f06d5745d09c7dc3fedbc7247b1e300f Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Wed, 15 Apr 2015 14:08:18 -0500 Subject: [PATCH] Copy InitialInstructions to prevent mutation --- dwarf/frame/table.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dwarf/frame/table.go b/dwarf/frame/table.go index 84c5f407..bd871766 100644 --- a/dwarf/frame/table.go +++ b/dwarf/frame/table.go @@ -119,6 +119,8 @@ var fnlookup = map[byte]instruction{ } func executeCIEInstructions(cie *CommonInformationEntry) *FrameContext { + initialInstructions := make([]byte, len(cie.InitialInstructions)) + copy(initialInstructions, cie.InitialInstructions) frame := &FrameContext{ cie: cie, regs: make(map[uint64]DWRule), @@ -126,7 +128,7 @@ func executeCIEInstructions(cie *CommonInformationEntry) *FrameContext { prevRegs: make(map[uint64]DWRule), codeAlignment: cie.CodeAlignmentFactor, dataAlignment: cie.DataAlignmentFactor, - buf: bytes.NewBuffer(cie.InitialInstructions), + buf: bytes.NewBuffer(initialInstructions), } frame.ExecuteDwarfProgram()