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

infinite loop issue fix #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
12 changes: 7 additions & 5 deletions libavformat/rtspdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ int ff_rtsp_parse_streaming_commands(AVFormatContext *s)
} else if (methodcode == TEARDOWN) {
rt->state = RTSP_STATE_IDLE;
ret = rtsp_send_reply(s, RTSP_STATUS_OK, NULL , request.seq);
return 0;
}
return ret;
}
Expand Down Expand Up @@ -698,7 +697,6 @@ static int rtsp_listen(AVFormatContext *s)
return AVERROR_INVALIDDATA;
}
}
return 0;
}

static int rtsp_probe(AVProbeData *p)
Expand Down Expand Up @@ -775,26 +773,30 @@ int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
return -1;
id = buf[0];
len = AV_RB16(buf + 1);
av_log(s, AV_LOG_TRACE, "id=%d len=%d\n", id, len);
av_log(s, AV_LOG_TRACE, "mitesh id=%d len=%d buf_size=%d\n", id, len, buf_size);
if (len > buf_size || len < 8)
goto redo;
/* get the data */
ret = ffurl_read_complete(rt->rtsp_hd, buf, len);
av_log(s, AV_LOG_TRACE, "mitesh1 id=%d len=%d ret=%d\n", id, len, ret);
if (ret != len)
return -1;
if (rt->transport == RTSP_TRANSPORT_RDT &&
ff_rdt_parse_header(buf, len, &id, NULL, NULL, NULL, NULL) < 0)
return -1;

av_log(s, AV_LOG_TRACE, "mitesh2 id=%d len=%d buf_size=%d\n", id, len, buf_size);
/* find the matching stream */
for (i = 0; i < rt->nb_rtsp_streams; i++) {
rtsp_st = rt->rtsp_streams[i];
if (id >= rtsp_st->interleaved_min &&
id <= rtsp_st->interleaved_max)
goto found;
}
goto redo;
av_log(s, AV_LOG_TRACE, "mitesh3 id=%d len=%d buf_size=%d\n", id, len, buf_size);
return 0;
//goto redo;
found:
av_log(s, AV_LOG_TRACE, "mitesh4 id=%d len=%d buf_size=%d\n", id, len, buf_size);
*prtsp_st = rtsp_st;
return len;
}
Expand Down