1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed handling error conditions in the index file

This commit is contained in:
Klaus Schmidinger 2022-01-24 10:44:21 +01:00
parent 8cde8464eb
commit ea1ad945b4
3 changed files with 11 additions and 4 deletions

View File

@ -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

View File

@ -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).

View File

@ -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;