fix possible segfault and negative height

Origin commit data
------------------
Branch: ni/coolstream
Commit: b8849d53b5
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2016-10-31 (Mon, 31 Oct 2016)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2016-10-31 15:53:29 +01:00
parent fbe6cdb8e1
commit 8412a9b608
4 changed files with 16 additions and 1 deletions

View File

@@ -676,7 +676,7 @@ fb_pixel_t* CFrameBuffer::paintBoxRel2Buf(const int dx, const int dy, const int
{
if (!getActive())
return buf;
if (dx == 0 || dy == 0) {
if (dx < 1 || dy < 1) {
dprintf(DEBUG_INFO, "[CFrameBuffer] [%s - %d]: radius %d, dx %d dy %d\n", __func__, __LINE__, radius, dx, dy);
return buf;
}
@@ -2026,6 +2026,9 @@ void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32
void CFrameBuffer::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff)
{
if(width <1 || height <1 || !boxBuf )
return;
uint32_t xc = (width > xRes) ? (uint32_t)xRes : width;
uint32_t yc = (height > yRes) ? (uint32_t)yRes : height;