Ticket #5179: libs_libmythtv-integer-overflow-in-QImage-ticket-5179.patch

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

Same patch, but uses the QT4 ctor and enum

  • 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 |    2 +-
     libs/libmythtv/osdlistbtntype.cpp    |    3 +--
     libs/libmythtv/previewgenerator.cpp  |    3 +--
     3 files changed, 3 insertions(+), 5 deletions(-)
    
    diff --git a/libs/libmythtv/NuppelVideoPlayer.cpp b/libs/libmythtv/NuppelVideoPlayer.cpp
    index 072b424..0876e58 100644
    a b const QImage &NuppelVideoPlayer::GetARGBFrame(QSize &size) 
    15861586                  w, h, w * 4, w, w / 2, 0);
    15871587
    15881588    argb_scaled_img = QImage(argb_buf, argb_size.width(), argb_size.height(),
    1589                              32, NULL, 65536 * 65536, QImage::LittleEndian);
     1589                             32, QImage::Format_RGB32);
    15901590
    15911591    return argb_scaled_img;
    15921592}
  • libs/libmythtv/osdlistbtntype.cpp

    diff --git a/libs/libmythtv/osdlistbtntype.cpp b/libs/libmythtv/osdlistbtntype.cpp
    index b746f8c..6cd6e5c 100644
    a b void OSDListBtnType::InitItem( 
    708708        *ptr = black;
    709709
    710710    {
    711         QImage img(data, width, height, 32, NULL, 65536 * 65536,
    712                    QImage::LittleEndian);
     711        QImage img(data, width, height, 32, QImage::Format_RGB32);
    713712        img.setAlphaBuffer(alpha<255);
    714713        osdImg.Load(img);
    715714    }
  • libs/libmythtv/previewgenerator.cpp

    diff --git a/libs/libmythtv/previewgenerator.cpp b/libs/libmythtv/previewgenerator.cpp
    index e482088..dd4330e 100644
    a b bool PreviewGenerator::SavePreview(QString filename, 
    429429        return false;
    430430
    431431    const QImage img((unsigned char*) data,
    432                      width, height, 32, NULL, 65536 * 65536,
    433                      QImage::LittleEndian);
     432                     width, height, 32, QImage::Format_RGB32);
    434433
    435434    float ppw = max(desired_width, 0);
    436435    float pph = max(desired_height, 0);