Skip to content
Snippets Groups Projects
Commit 7c615360 authored by Andreas Huber's avatar Andreas Huber
Browse files

Fail to parse duration instead of asserting, if the server response cannot be parsed.

Change-Id: I95c61ed83800db82e99c0023b942fb8ae05ed3cf
related-to-bug: 3338518
parent 7e2f9cc8
No related branches found
No related tags found
No related merge requests found
......@@ -265,15 +265,17 @@ bool ASessionDescription::getDurationUs(int64_t *durationUs) const {
const char *s = value.c_str() + 4;
char *end;
double from = strtod(s, &end);
CHECK_GT(end, s);
CHECK_EQ(*end, '-');
if (end == s || *end != '-') {
return false;
}
s = end + 1;
double to = strtod(s, &end);
CHECK_GT(end, s);
CHECK_EQ(*end, '\0');
CHECK_GE(to, from);
if (end == s || *end != '\0' || to < from) {
return false;
}
*durationUs = (int64_t)((to - from) * 1E6);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment