[vlc-devel] CRLF parsing error in live555

David Schueler david.schueler at tel-billig.de
Thu Jun 5 13:49:49 CEST 2008


Hello!

I noticed an error in live555 library when a RTSP server is sending LF as 
line ending instead of CRLF.
The RTSP RFC is defining in a clear way, that CR, LF or CRLF can be used 
as line ending.
The live555 takes care of CRLF only.
The result is, that VLC (or any other live555 related program) is waiting 
for infinite time.

I called attention to the live555 support via email. If they fix the error 
in future, some of you should take this change into VLC.

I've always made a little change in RTSPClient.cpp of live555 and tested 
with openRTSP and all worked fine.
Here's the diff of that file if you nedd it.
--- RTSPClient_orig.cpp 2008-05-12 11:01:08.000000000 +0200
+++ RTSPClient.cpp      2008-06-05 12:15:20.000000000 +0200
@@ -148,8 +148,12 @@
   for (char* ptr = startOfLine; *ptr != '\0'; ++ptr) {
     if (*ptr == '\r' || *ptr == '\n') {
       // We found the end of the line
+      if (*ptr == '\r') {
       *ptr++ = '\0';
       if (*ptr == '\n') ++ptr;
+      } else {
+        *ptr++ = '\0';
+      }
       return ptr;
     }
   }
@@ -2144,8 +2148,8 @@
     if (lastToCheck < responseBuffer) continue;
     for (; p <= lastToCheck; ++p) {
       if (haveSeenNonCRLF) {
-       if (*p == '\r' && *(p+1) == '\n' &&
-           *(p+2) == '\r' && *(p+3) == '\n') {
+       if ((*p == '\r' && *(p+1) == '\n' && *(p+2) == '\r' && *(p+3) == 
'\n') ||
+           (*(p+2) == '\n' && *(p+3) == '\n')) {
          responseBuffer[bytesRead] = '\0';
 
          // Before returning, trim any \r or \n from the start:

Regards.

David Schueler
-- 
MFK-Handys Germany
Department of Research and Development
Ohrdrufer Strasse 14
98716 Geraberg / Germany

Tel.: +49 3677 799077
Fax.: +49 3677 791942
Mail: david.schueler at tel-billig.de



More information about the vlc-devel mailing list