From 934ca8cb1bcffcf1781a576ca625d2f901e5f0a9 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Wed, 12 Jan 2011 09:57:23 -0800 Subject: Fail to parse duration instead of asserting, if the server response cannot be parsed. Change-Id: I42324468edca5ccce29486059091da8e64f36326 related-to-bug: 3338518 --- media/libstagefright/rtsp/ASessionDescription.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'media/libstagefright/rtsp/ASessionDescription.cpp') diff --git a/media/libstagefright/rtsp/ASessionDescription.cpp b/media/libstagefright/rtsp/ASessionDescription.cpp index 547fbab..77917b3 100644 --- a/media/libstagefright/rtsp/ASessionDescription.cpp +++ b/media/libstagefright/rtsp/ASessionDescription.cpp @@ -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); -- cgit v1.1