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

nil pointer dereference in RTPReceiver readRTP #2929

Open
LeeTeng2001 opened this issue Oct 12, 2024 · 4 comments · May be fixed by #2930
Open

nil pointer dereference in RTPReceiver readRTP #2929

LeeTeng2001 opened this issue Oct 12, 2024 · 4 comments · May be fixed by #2930

Comments

@LeeTeng2001
Copy link
Contributor

Your environment.

  • Version: v3.2.40
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x7ff724f803d7]

goroutine 129 [running]:
github.com/pion/webrtc/v3.(*RTPReceiver).readRTP(0xc000414d80, {0xc000150600, 0x5b4, 0x5b4}, 0xc00077ea20)
        C:/Users/teng.lee/go/pkg/mod/github.com/pion/webrtc/[email protected]/rtpreceiver.go:369 +0xf7
github.com/pion/webrtc/v3.(*TrackRemote).Read(0xc00077ea20, {0xc000150600, 0x5b4, 0x5b4})
        C:/Users/teng.lee/go/pkg/mod/github.com/pion/webrtc/[email protected]/track_remote.go:139 +0x24e
github.com/pion/webrtc/v3.(*TrackRemote).peek(0xc00077ea20, {0xc000150600, 0x16?, 0x5b4})
        C:/Users/teng.lee/go/pkg/mod/github.com/pion/webrtc/[email protected]/track_remote.go:191 +0x26
github.com/pion/webrtc/v3.(*PeerConnection).startReceiver.func1(0xc00077ea20)
        C:/Users/teng.lee/go/pkg/mod/github.com/pion/webrtc/[email protected]/peerconnection.go:1241 +0x7a
created by github.com/pion/webrtc/v3.(*PeerConnection).startReceiver in goroutine 105
        C:/Users/teng.lee/go/pkg/mod/github.com/pion/webrtc/[email protected]/peerconnection.go:1239 +0x1e5
exit status 2

What did you do?

Run pion with unsupported codec at remote? I'm not sure how to pin point the problem

What did you expect?

ignore error and continue running

What happened?

nil pointer dereference and panic

Temporary solution

Right now, I added a check for rtcpinterceptor to be nil before returning, this is not ideal as I need to modify the source code

// readRTP should only be called by a track, this only exists so we can keep state in one place
func (r *RTPReceiver) readRTP(b []byte, reader *TrackRemote) (n int, a interceptor.Attributes, err error) {
	<-r.received
	if t := r.streamsForTrack(reader); t != nil {
		if t.rtcpInterceptor == nil {
			return 0, nil, nil
		}
		return t.rtpInterceptor.Read(b, a)
	}

	return 0, nil, fmt.Errorf("%w: %d", errRTPReceiverWithSSRCTrackStreamNotFound, reader.SSRC())
}
@LeeTeng2001
Copy link
Contributor Author

Might be related? #2322

@Sean-Der
Copy link
Member

Nice find! Mind sending a PR @LeeTeng2001 would love to see this fixed :)

@LeeTeng2001 LeeTeng2001 linked a pull request Oct 14, 2024 that will close this issue
@LeeTeng2001
Copy link
Contributor Author

@Sean-Der mind reviewing my pr and merge it? thanks!

@LeeTeng2001
Copy link
Contributor Author

Hi I would like this issue to fix in v3, so should I merge to master or v3 ?

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

Successfully merging a pull request may close this issue.

2 participants