Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions internal/encoder/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
}

func getFilteredCodeSetIfNeeded(ctx *RuntimeContext, codeSet *OpcodeSet) (*OpcodeSet, error) {
//Initializing a deep copy to unexpected fault address
codeSet = codeSet.deepCopy()
if (ctx.Option.Flag & ContextOption) == 0 {
return codeSet, nil
}
Expand All @@ -87,6 +89,23 @@
codeSet.setQueryCache(query.Hash(), queryCodeSet)
return queryCodeSet, nil
}
func (codeSet *OpcodeSet) deepCopy() *OpcodeSet {

Check failure on line 92 in internal/encoder/compiler.go

View workflow job for this annotation

GitHub Actions / Lint

ST1016: methods on the same type should have the same receiver name (seen 1x "codeSet", 2x "s") (stylecheck)
if codeSet == nil {
return nil
}
return &OpcodeSet{
Type: codeSet.Type,
NoescapeKeyCode: codeSet.NoescapeKeyCode,
EscapeKeyCode: codeSet.EscapeKeyCode,
InterfaceNoescapeKeyCode: codeSet.InterfaceNoescapeKeyCode,
InterfaceEscapeKeyCode: codeSet.EscapeKeyCode,
CodeLength: codeSet.CodeLength,
EndCode: codeSet.EndCode,
Code: codeSet.Code,
QueryCache: make(map[string]*OpcodeSet),
cacheMu: sync.RWMutex{},
}
}

type Compiler struct {
structTypeToCode map[uintptr]*StructCode
Expand Down
Loading