Skip to content

Commit cfe9106

Browse files
committed
fixed crash when not enought pixel data is available
1 parent 090db06 commit cfe9106

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/kernel/tui/TUISGBrowserTab.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,10 +694,25 @@ void TUISGBrowserTab::setValue(TabletValue type, covise::TokenBuffer &tb)
694694
if (dataLength > 0)
695695
{
696696
if (depth == 32)
697+
{
698+
if(dataLength < (width*height*3))
699+
{
700+
std::cerr << " not enought image data" << dataLength << " should be " << (width*height*3) << std::endl;
701+
}
702+
else
697703
image = QImage(reinterpret_cast<unsigned char *>(sendData), width, height, QImage::Format_RGB32);
704+
image = image.mirrored();
705+
}
698706
else
707+
{
708+
if(dataLength < (width*height*4))
709+
{
710+
std::cerr << " not enought image data" << dataLength << " should be " << (width*height*4) << std::endl;
711+
}
712+
else
699713
image = QImage(reinterpret_cast<unsigned char *>(sendData), width, height, QImage::Format_ARGB32);
700714
image = image.mirrored();
715+
}
701716
}
702717
int num = numItems;
703718
auto t = std::chrono::steady_clock::now().time_since_epoch();

0 commit comments

Comments
 (0)