From 747935e901f3fc1ce724dfdf84c86406e8fa1524 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 29 Jan 2020 23:35:31 +0100 Subject: [PATCH] fb_generic: fix compil warning Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/3fbd2b171603e92371b0cc8adeabab5a9ff1d7e4 Author: Jacek Jendrzej Date: 2020-01-29 (Wed, 29 Jan 2020) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_generic.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 82cc1f561..d07c9f2f1 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -770,7 +770,12 @@ bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const i return false; } - read(lfd, &header, sizeof(struct rawHeader)); + ssize_t r = read(lfd, &header, sizeof(struct rawHeader)); + if(r <= 0) + { + close(fd); + return false; + } width = (header.width_hi << 8) | header.width_lo; height = (header.height_hi << 8) | header.height_lo; @@ -786,7 +791,11 @@ bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const i fb_pixel_t *d = getFrameBufferPointer() + x + swidth * y; fb_pixel_t * d2; for (int count=0; count> 1 ); + s = read(lfd, &pixbuf[0], width >> 1 ); + if(s <= 0) + { + break; + } unsigned char *pixpos = &pixbuf[0]; for (int count2 = 0; count2 < width >> 1; count2 ++ ) { unsigned char compressed = *pixpos;