Ticket #5179: libs_libmyhtv-integer-overflow-in-QImage.patch

File libs_libmyhtv-integer-overflow-in-QImage.patch, 2.3 KB (added by Erik Hovland <erik@…>, 12 years ago)

changes the 4Mibi value in the ctor call to the INT_MAX macro from the C library

  • libs/libmythtv/NuppelVideoPlayer.cpp

    Since QImage takes an int as the value for colors, it can be overflowed by giving it
    
    From: Erik Hovland <erik@hovland.org>
    
    4Gi colors.
    ---
    
     libs/libmythtv/NuppelVideoPlayer.cpp |    3 ++-
     libs/libmythtv/osdlistbtntype.cpp    |    3 ++-
     libs/libmythtv/previewgenerator.cpp  |    3 ++-
     3 files changed, 6 insertions(+), 3 deletions(-)
    
    diff --git a/libs/libmythtv/NuppelVideoPlayer.cpp b/libs/libmythtv/NuppelVideoPlayer.cpp
    index 072b424..2834cba 100644
    a b  
    77#include <cerrno>
    88#include <ctime>
    99#include <cmath>
     10#include <limits.h>
    1011
    1112// POSIX headers
    1213#include <unistd.h>
    const QImage &NuppelVideoPlayer::GetARGBFrame(QSize &size) 
    15861587                  w, h, w * 4, w, w / 2, 0);
    15871588
    15881589    argb_scaled_img = QImage(argb_buf, argb_size.width(), argb_size.height(),
    1589                              32, NULL, 65536 * 65536, QImage::LittleEndian);
     1590                             32, NULL, INT_MAX, QImage::LittleEndian);
    15901591
    15911592    return argb_scaled_img;
    15921593}
  • libs/libmythtv/osdlistbtntype.cpp

    diff --git a/libs/libmythtv/osdlistbtntype.cpp b/libs/libmythtv/osdlistbtntype.cpp
    index b746f8c..93b6bf3 100644
    a b  
    2121
    2222// ANSI C headers
    2323#include <cmath>
     24#include <limits.h>
    2425
    2526// C++ headers
    2627#include <algorithm>
    void OSDListBtnType::InitItem( 
    708709        *ptr = black;
    709710
    710711    {
    711         QImage img(data, width, height, 32, NULL, 65536 * 65536,
     712        QImage img(data, width, height, 32, NULL, INT_MAX,
    712713                   QImage::LittleEndian);
    713714        img.setAlphaBuffer(alpha<255);
    714715        osdImg.Load(img);
  • libs/libmythtv/previewgenerator.cpp

    diff --git a/libs/libmythtv/previewgenerator.cpp b/libs/libmythtv/previewgenerator.cpp
    index e482088..e0d551d 100644
    a b  
    11// C headers
    22#include <cmath>
     3#include <limits.h>
    34
    45// POSIX headers
    56#include <sys/types.h> // for stat
    bool PreviewGenerator::SavePreview(QString filename, 
    429430        return false;
    430431
    431432    const QImage img((unsigned char*) data,
    432                      width, height, 32, NULL, 65536 * 65536,
     433                     width, height, 32, NULL, INT_MAX,
    433434                     QImage::LittleEndian);
    434435
    435436    float ppw = max(desired_width, 0);