]> git.vomp.tv Git - vompclient.git/commitdiff
Fix segfault when server returns a getblock with size 0
authorChris Tallon <chris@vomp.tv>
Mon, 23 Jan 2017 15:16:42 +0000 (15:16 +0000)
committerChris Tallon <chris@vomp.tv>
Mon, 23 Jan 2017 15:16:42 +0000 (15:16 +0000)
player.cc [changed mode: 0644->0755]
vdr.cc [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 3811a76..c93c733
--- a/player.cc
+++ b/player.cc
@@ -1375,8 +1375,8 @@ void Player::threadFeedScan()
     logger->log("Player", Log::DEBUG, "XXX Got frame");
 
     threadBuffer = vdr->getBlock(filePos, iframeLength, &amountReceived);
-    
-    if (!vdr->isConnected())
+
+    if (!vdr->isConnected() || !amountReceived)
     {
       if (threadBuffer) free(threadBuffer);
       doConnectionLost();
diff --git a/vdr.cc b/vdr.cc
old mode 100644 (file)
new mode 100755 (executable)
index ee19f82..db0dc9d
--- a/vdr.cc
+++ b/vdr.cc
@@ -960,6 +960,7 @@ UCHAR* VDR::getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived)
   if (vresp->serverError())
   {
     logger->log("VDR", Log::DEBUG, "Detected getblock 0");
+    *amountReceived = 0;
     delete vresp;
     return NULL;
   }