mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed a possible crash when loading an invalid XPM file
This commit is contained in:
parent
9809d5a7cc
commit
2838e27fb9
@ -1695,6 +1695,7 @@ Henrik Niehaus <henrik.niehaus@gmx.de>
|
|||||||
Martin Wache <M.Wache@gmx.net>
|
Martin Wache <M.Wache@gmx.net>
|
||||||
for adding a sleep in cDvbPlayer::Action() in case there is no data to send to the
|
for adding a sleep in cDvbPlayer::Action() in case there is no data to send to the
|
||||||
device, which avoids a busy loop on very fast machines
|
device, which avoids a busy loop on very fast machines
|
||||||
|
for fixing a possible crash when loading an invalid XPM file
|
||||||
|
|
||||||
Matthias Lenk <matthias.lenk@amd.com>
|
Matthias Lenk <matthias.lenk@amd.com>
|
||||||
for reporting an out-of-bounds memory access with audio language ids
|
for reporting an out-of-bounds memory access with audio language ids
|
||||||
|
3
HISTORY
3
HISTORY
@ -5036,6 +5036,7 @@ Video Disk Recorder Revision History
|
|||||||
with open file handles when starting background commands (thanks to Reinhard
|
with open file handles when starting background commands (thanks to Reinhard
|
||||||
Nissl).
|
Nissl).
|
||||||
|
|
||||||
2007-02-03: Version 1.4.5-2
|
2007-02-17: Version 1.4.5-2
|
||||||
|
|
||||||
- Removed 'assert(0)' from cDvbSpuDecoder::setTime() (thanks to Marco Schlüßler).
|
- Removed 'assert(0)' from cDvbSpuDecoder::setTime() (thanks to Marco Schlüßler).
|
||||||
|
- Fixed a possible crash when loading an invalid XPM file (thanks to Martin Wache).
|
||||||
|
22
osd.c
22
osd.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: osd.c 1.67 2006/02/26 14:31:31 kls Exp $
|
* $Id: osd.c 1.67.1.1 2007/02/17 16:05:52 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
@ -218,14 +218,17 @@ bool cBitmap::LoadXpm(const char *FileName)
|
|||||||
int w, h, n, c;
|
int w, h, n, c;
|
||||||
if (4 != sscanf(s, "%d %d %d %d", &w, &h, &n, &c)) {
|
if (4 != sscanf(s, "%d %d %d %d", &w, &h, &n, &c)) {
|
||||||
esyslog("ERROR: faulty 'values' line in XPM file '%s'", FileName);
|
esyslog("ERROR: faulty 'values' line in XPM file '%s'", FileName);
|
||||||
|
isXpm = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lines = h + n + 1;
|
lines = h + n + 1;
|
||||||
Xpm = MALLOC(char *, lines);
|
Xpm = MALLOC(char *, lines);
|
||||||
|
memset(Xpm, 0, lines * sizeof(char*));
|
||||||
}
|
}
|
||||||
char *q = strchr(s, '"');
|
char *q = strchr(s, '"');
|
||||||
if (!q) {
|
if (!q) {
|
||||||
esyslog("ERROR: missing quotes in XPM file '%s'", FileName);
|
esyslog("ERROR: missing quotes in XPM file '%s'", FileName);
|
||||||
|
isXpm = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*q = 0;
|
*q = 0;
|
||||||
@ -233,16 +236,21 @@ bool cBitmap::LoadXpm(const char *FileName)
|
|||||||
Xpm[index++] = strdup(s);
|
Xpm[index++] = strdup(s);
|
||||||
else {
|
else {
|
||||||
esyslog("ERROR: too many lines in XPM file '%s'", FileName);
|
esyslog("ERROR: too many lines in XPM file '%s'", FileName);
|
||||||
|
isXpm = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (index == lines)
|
if (isXpm) {
|
||||||
Result = SetXpm(Xpm);
|
if (index == lines)
|
||||||
else
|
Result = SetXpm(Xpm);
|
||||||
esyslog("ERROR: too few lines in XPM file '%s'", FileName);
|
else
|
||||||
for (int i = 0; i < index; i++)
|
esyslog("ERROR: too few lines in XPM file '%s'", FileName);
|
||||||
free(Xpm[i]);
|
}
|
||||||
|
if (Xpm) {
|
||||||
|
for (int i = 0; i < index; i++)
|
||||||
|
free(Xpm[i]);
|
||||||
|
}
|
||||||
free(Xpm);
|
free(Xpm);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user