From 6cb818c7ad20c99054f0c2d292342de99d33c2ca Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 16 Nov 2020 15:53:53 +0100 Subject: [PATCH] Fixed allocating memory for cImage --- CONTRIBUTORS | 1 + HISTORY | 3 ++- osd.c | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 29cbae75..35b050f0 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2443,6 +2443,7 @@ Christoph Haubrich for adding support for HEVC-video and AC-4-audio for implementing anti-aliasing for cPixmap::DrawSlope() and cPixmap::DrawEllipse() for reporting an unnecessary double call to Display() in cMenuRecording::RefreshRecording() + for reporting too much memory being allocated in the cImage constructors Pekka Mauno for fixing cSchedule::GetFollowingEvent() in case there is currently no present diff --git a/HISTORY b/HISTORY index 6cfbcb53..8daf803e 100644 --- a/HISTORY +++ b/HISTORY @@ -9536,10 +9536,11 @@ Video Disk Recorder Revision History cDvbTuner::GetSignalStats() to avoid problems with drivers that don't do this (thanks to Helmut Binder). -2020-11-06: +2020-11-16: - Fixed multiple recording entries in case a recording is started during the initial reading of the video directory (reported by Claus Muus). - Fixed an unnecessary double call to Display() in cMenuRecording::RefreshRecording() (reported by Christoph Haubrich). - Fixed a crash in case an error occurs when setting a remote timer. +- Fixed allocating memory for cImage (reported by Christoph Haubrich). diff --git a/osd.c b/osd.c index 4b1dd051..6652325c 100644 --- a/osd.c +++ b/osd.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.c 4.9 2020/10/13 13:47:10 kls Exp $ + * $Id: osd.c 4.10 2020/11/16 15:53:53 kls Exp $ */ #include "osd.h" @@ -1109,18 +1109,18 @@ cImage::cImage(void) cImage::cImage(const cImage &Image) { size = Image.Size(); - int l = size.Width() * size.Height() * sizeof(tColor); + int l = size.Width() * size.Height(); data = MALLOC(tColor, l); - memcpy(data, Image.Data(), l); + memcpy(data, Image.Data(), l * sizeof(tColor)); } cImage::cImage(const cSize &Size, const tColor *Data) { size = Size; - int l = size.Width() * size.Height() * sizeof(tColor); + int l = size.Width() * size.Height(); data = MALLOC(tColor, l); if (Data) - memcpy(data, Data, l); + memcpy(data, Data, l * sizeof(tColor)); } cImage::~cImage()