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

Fixed reallocating memory in the "pictures" plugin

This commit is contained in:
Klaus Schmidinger 2011-02-20 17:19:54 +01:00
parent 698ffdc970
commit e85852672f
5 changed files with 19 additions and 5 deletions

View File

@ -2614,6 +2614,7 @@ Eric Valette <eric.valette@free.fr>
Paul Menzel <paulepanter@users.sourceforge.net> Paul Menzel <paulepanter@users.sourceforge.net>
for making include paths not be overwritten in the Makefile for making include paths not be overwritten in the Makefile
for adding LDFLAGS to the linker calls in the Makefiles for adding LDFLAGS to the linker calls in the Makefiles
for reporting a possible memory leak in the "pictures" plugin
Radek Stastny <dedkus@gmail.com> Radek Stastny <dedkus@gmail.com>
for translating OSD texts to the Czech language for translating OSD texts to the Czech language

View File

@ -6535,3 +6535,5 @@ Video Disk Recorder Revision History
implementation of the AlphaBlend() function. implementation of the AlphaBlend() function.
- Updated the Slovakian language texts (thanks to Milan Hrala). - Updated the Slovakian language texts (thanks to Milan Hrala).
- Added Serbian language texts (thanks to Milan Cvijanovic). - Added Serbian language texts (thanks to Milan Cvijanovic).
- Fixed reallocating memory in the "pictures" plugin (reported by Paul Menzel, with
input from Oliver Endriss).

View File

@ -41,3 +41,7 @@ VDR Plugin 'pictures' Revision History
2010-02-28: Version 0.0.9 2010-02-28: Version 0.0.9
- Added Lithuanian language translations (thanks to Valdemaras Pipiras). - Added Lithuanian language translations (thanks to Valdemaras Pipiras).
2011-02-20: Version 0.1.0
- Fixed reallocating memory (reported by Paul Menzel).

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: pictures.c 2.2 2010/02/28 12:49:55 kls Exp $ * $Id: pictures.c 2.3 2011/02/20 16:50:01 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -11,7 +11,7 @@
#include "menu.h" #include "menu.h"
#include "player.h" #include "player.h"
static const char *VERSION = "0.0.9"; static const char *VERSION = "0.1.0";
static const char *DESCRIPTION = trNOOP("A simple picture viewer"); static const char *DESCRIPTION = trNOOP("A simple picture viewer");
static const char *MAINMENUENTRY = trNOOP("Pictures"); static const char *MAINMENUENTRY = trNOOP("Pictures");

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: player.c 1.3 2008/02/09 12:13:10 kls Exp $ * $Id: player.c 2.1 2011/02/20 17:15:25 kls Exp $
*/ */
#include "player.h" #include "player.h"
@ -66,8 +66,15 @@ void cPicturePlayer::SetPicture(const char *FileName)
length = read(f, buffer, size); length = read(f, buffer, size);
if (length > 0) { if (length > 0) {
if (length >= size) { if (length >= size) {
size = size * 3 / 2; int NewSize = size * 3 / 2;
buffer = (uchar *)realloc(buffer, size); if (uchar *NewBuffer = (uchar *)realloc(buffer, NewSize)) {
buffer = NewBuffer;
size = NewSize;
}
else {
LOG_ERROR_STR("out of memory");
break;
}
lseek(f, 0, SEEK_SET); lseek(f, 0, SEEK_SET);
continue; continue;
} }