webrtc
webrtc copied to clipboard
nil pointer dereference in RTPReceiver readRTP
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())
}
Might be related? #2322
Nice find! Mind sending a PR @LeeTeng2001 would love to see this fixed :)
@Sean-Der mind reviewing my pr and merge it? thanks!
Hi I would like this issue to fix in v3, so should I merge to master or v3 ?