mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CTextBox: catching error if position has signed values
Wrong position assignments can trigger crash. Prevent segfaults. Error log should indicate this.
This commit is contained in:
@@ -56,7 +56,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <global.h>
|
#include <global.h>
|
||||||
|
#include <system/debug.h>
|
||||||
#include "textbox.h"
|
#include "textbox.h"
|
||||||
#include <gui/widget/icons.h>
|
#include <gui/widget/icons.h>
|
||||||
|
|
||||||
@@ -553,13 +553,13 @@ void CTextBox::refreshText(void)
|
|||||||
|
|
||||||
//bg variables
|
//bg variables
|
||||||
int ax = m_cFrameTextRel.iX+m_cFrame.iX;
|
int ax = m_cFrameTextRel.iX+m_cFrame.iX;
|
||||||
int ay = /*m_cFrameTextRel.iY+*/m_cFrame.iY;
|
int ay = m_cFrameTextRel.iY+m_cFrame.iY;
|
||||||
int dx = m_cFrameTextRel.iWidth;
|
int dx = m_cFrameTextRel.iWidth;
|
||||||
int dy = m_cFrameTextRel.iHeight;
|
int dy = m_cFrameTextRel.iHeight;
|
||||||
|
|
||||||
//find changes
|
//find changes
|
||||||
bool has_changed = hasChanged(&ax, &ay, &dx, &dy);
|
bool has_changed = hasChanged(&ax, &ay, &dx, &dy);
|
||||||
|
|
||||||
//destroy pixel buffer on changed property values
|
//destroy pixel buffer on changed property values
|
||||||
if (has_changed){
|
if (has_changed){
|
||||||
if (m_bgpixbuf){
|
if (m_bgpixbuf){
|
||||||
@@ -569,6 +569,12 @@ void CTextBox::refreshText(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//detect corrupt position values
|
||||||
|
if ((ax<=0) || (ay<=0)){
|
||||||
|
dprintf(DEBUG_NORMAL, "\033[33m[CTextBox] [%s - %d] ERROR! position out of range: ax = %d, ay = %d, dx = %d, dy = %d\033[0m\n", __func__, __LINE__, ax, ay, dx, dy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//save screen only if no paint of background required
|
//save screen only if no paint of background required
|
||||||
if (!m_nPaintBackground && m_SaveScreen) {
|
if (!m_nPaintBackground && m_SaveScreen) {
|
||||||
if (m_bgpixbuf == NULL){
|
if (m_bgpixbuf == NULL){
|
||||||
|
Reference in New Issue
Block a user