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

parse field tag and interface method name #38

Merged
merged 4 commits into from
Oct 6, 2023

Conversation

virusdefender
Copy link
Contributor

@virusdefender virusdefender commented Sep 15, 2023

fix #37

the sample binary source code is

package main

import "fmt"

type interface1 interface {
	Interface1Method()
	interface1Method1(string, int) (string, error)
}

type ExampleStruct struct {
	StructField string `json:"StructFieldTag"`
}

type ExampleStruct1 struct {
	Data struct {
		StructField1 string `json:"StructFieldTag1"`
	} `json:"DataTag"`
}

func (e *ExampleStruct1) Interface1Method() {
	fmt.Println("Interface1Method")
}

func (e *ExampleStruct1) interface1Method1(string, int) (string, error) {
	fmt.Println("interface1Method1")
	return "", nil
}

func main() {
	fmt.Println(ExampleStruct{}, ExampleStruct1{})
	var i interface1
	i = &ExampleStruct1{}
	i.Interface1Method()
}

diff of this branch vs master

image

image

Note

-Reconstructed field is not valid golang code in many cases, so i add some hack to make it to valid format in common cases.

@virusdefender virusdefender force-pushed the master branch 3 times, most recently from 935d76d to fd0d515 Compare September 15, 2023 08:57
@virusdefender virusdefender marked this pull request as ready for review September 15, 2023 08:57
@stevemk14ebr
Copy link
Collaborator

It's fine to remove the type prefix

@virusdefender virusdefender changed the title parse field tag parse field tag and interface method name Sep 20, 2023
@stevemk14ebr stevemk14ebr merged commit 49f4186 into mandiant:master Oct 6, 2023
1 check passed
@stevemk14ebr
Copy link
Collaborator

You can re-open this, I am not convinced there is entirely correct. I see an unreference flag local in the 1.20 code path. And I see you are parsing out the 'flag' and comparing it to 3, but the rtype flags are already passed to the 'readRtypeName' function as an argument. And I also see adjustments to the name_len fields as mentioned in review, I don't believe this is correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

field tag and method name is not parsed
2 participants