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

Fuzzing SIP parser #7

Open
negbie opened this issue Jun 27, 2020 · 6 comments
Open

Fuzzing SIP parser #7

negbie opened this issue Jun 27, 2020 · 6 comments
Assignees

Comments

@negbie
Copy link
Collaborator

negbie commented Jun 27, 2020

Fuzzit was acquired by GitLab, so I think it's not an option anymore? Let's use good old gofuzz.
https://github.com/google/gofuzz

@negbie negbie self-assigned this Jun 27, 2020
@jart
Copy link
Owner

jart commented Jun 27, 2020

Fuzzing is an even smarter way to do it than the RFC torture tests. I'd welcome a change like this.

@negbie
Copy link
Collaborator Author

negbie commented Jun 27, 2020

Did you have considered to move the SIP, SDP parser into a separate repository? This would reduce the scope and mby gain more search hit's? Since I've used Ragel in some projects myself (like fast CSeq parser) I know that it's mby not the fastest way to build a SIP parser BUT it's a good way to build a fast and correct one. Your implementation has a good quality, better than the most others you can find for Go on Github. Just thinking out loud ;)

@jart
Copy link
Owner

jart commented Jun 27, 2020

Would that help people only link the parts they need? If so I say let's do that.
What do you think of naming the directories sip/parse/ and sdp/parse/?

@negbie
Copy link
Collaborator Author

negbie commented Jun 27, 2020

I still think there is a lack of a fast and correct general purpose SIP/SDP parser in Go. Probably because of this some of the existing SIP stacks in Go on Github come with their own implementations.

What do you think of naming the directories sip/parse/ and sdp/parse/?

With the current function names this would result in

...parse.Parse() (for SDP)
...parse.ParseMsg (for SIP)

Go also has a parser package https://golang.org/pkg/go/parser

Shadowing that style it could be sip/parser/ and sdp/parser/ like:
parser.ParseSIP()
parser.ParseSDP()

@jart
Copy link
Owner

jart commented Jun 27, 2020

Ah yes that's a good point, regarding Go readability. Taking a quick glance at the Effective Go guide, how about sip/sipfsm and sdp/sdpfsm which are succinct, unique, and short for Finite State Machine.

Out of curiosity, does the Go linker do the equivalent of -ffunction-sections? We might want to try building a binary that only references the existing sip.ParseSIP() function and verifying that it doesn't schlep in things like the dialog and socket code.

@negbie
Copy link
Collaborator Author

negbie commented Jun 27, 2020

Taking a quick glance at the Effective Go guide, how about sip/sipfsm and sdp/sdpfsm which are succinct, unique, and short for Finite State Machine.

+1

Out of curiosity, does the Go linker do the equivalent of -ffunction-sections? We might want to try building a binary that only references the existing sip.ParseSIP() function and verifying that it doesn't schlep in things like the dialog and socket code.

Go's nearest equivalent of -ffunction-sections are Build Constraints better known as build tags.
https://golang.org/pkg/go/build/#hdr-Build_Constraints

Currently you don't use any external dependencies and without having a huge codebase I think it's probably not worth the effort.

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

No branches or pull requests

2 participants