diff options
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | recording.c | 11 |
3 files changed, 11 insertions, 4 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 398ef456..6a8db43a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2536,6 +2536,7 @@ Markus Ehrnsperger <markus.ehrnsperger@googlemail.com> for reporting a problem with missing 'INCLUDES += -I$(DVBDIR)/include' in an existing Make.config for reporting a bug in error handling when loading a plugin + for reporting a possible crash in cIndexFile::GetClosestIFrame() Werner Färber <w.faerber@gmx.de> for reporting a bug in handling the cPluginManager::Active() result when pressing @@ -9766,7 +9766,7 @@ Video Disk Recorder Revision History (reported by Timo Weingärtner). - Official release. -2022-01-18: +2022-01-24: - Replaced strncpy() with memcpy() in strreplace() to avoid a compiler warning (reported by Marco Mäkelä). @@ -9774,3 +9774,4 @@ Video Disk Recorder Revision History - Updated the Italian OSD texts (thanks to Diego Pierotto). - Added some missing "AUTO" values to vdr.5 (thanks to Winfried Köhler). - Fixed handling zero bytes in cH264Parser (thanks to Christoph Haubrich). +- Fixed handling error conditions in the index file (reported by Markus Ehrnsperger). diff --git a/recording.c b/recording.c index 47587de7..0bff62b6 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 5.13 2021/07/01 15:40:46 kls Exp $ + * $Id: recording.c 5.14 2022/01/24 10:44:21 kls Exp $ */ #include "recording.h" @@ -2604,6 +2604,8 @@ cIndexFile::cIndexFile(const char *FileName, bool Record, bool IsPesRecording, b if (safe_read(f, index, size_t(buf.st_size)) != buf.st_size) { esyslog("ERROR: can't read from file '%s'", *fileName); free(index); + size = 0; + last = -1; index = NULL; } else if (isPesRecording) @@ -2617,8 +2619,11 @@ cIndexFile::cIndexFile(const char *FileName, bool Record, bool IsPesRecording, b else LOG_ERROR_STR(*fileName); } - else + else { esyslog("ERROR: can't allocate %zd bytes for index '%s'", size * sizeof(tIndexTs), *fileName); + size = 0; + last = -1; + } } } else @@ -2817,7 +2822,7 @@ int cIndexFile::GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber, off int cIndexFile::GetClosestIFrame(int Index) { - if (last > 0) { + if (index && last > 0) { Index = constrain(Index, 0, last); if (index[Index].independent) return Index; |