diff options
author | William Wilgus <wilgus.william@gmail.com> | 2024-06-02 10:32:47 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2024-06-02 10:32:47 -0400 |
commit | cc67f420f215481ef41ed2bc228fb2b28f7eeb80 (patch) | |
tree | f266481bb6d40dfca116a3810d58309a00379cfb /firmware/font.c | |
parent | 5d34887d4ac3c3a2fcd6827f3ca70def65336591 (diff) | |
download | rockbox-cc67f420f215481ef41ed2bc228fb2b28f7eeb80.tar.gz rockbox-cc67f420f215481ef41ed2bc228fb2b28f7eeb80.zip |
[coverity] font.c load_cache_entry check for successful read
Change-Id: Ic2d8d6e498417983af7ee691f53dfb1e951561fa
Diffstat (limited to 'firmware/font.c')
-rw-r--r-- | firmware/font.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/firmware/font.c b/firmware/font.c index baaec13d3c..ffa5855d10 100644 --- a/firmware/font.c +++ b/firmware/font.c | |||
@@ -724,7 +724,6 @@ load_cache_entry(struct font_cache_entry* p, void* callback_data) | |||
724 | struct font* pf = callback_data; | 724 | struct font* pf = callback_data; |
725 | 725 | ||
726 | unsigned short char_code = p->_char_code; | 726 | unsigned short char_code = p->_char_code; |
727 | unsigned char tmp[2]; | ||
728 | int fd; | 727 | int fd; |
729 | 728 | ||
730 | lock_font_handle(pf->handle, true); | 729 | lock_font_handle(pf->handle, true); |
@@ -755,11 +754,14 @@ load_cache_entry(struct font_cache_entry* p, void* callback_data) | |||
755 | else | 754 | else |
756 | fd = pf->fd; | 755 | fd = pf->fd; |
757 | lseek(fd, offset, SEEK_SET); | 756 | lseek(fd, offset, SEEK_SET); |
758 | read (fd, tmp, 2); | 757 | unsigned char tmp[2]; |
759 | bitmap_offset = tmp[0] | (tmp[1] << 8); | 758 | if (read (fd, tmp, 2) == 2) |
760 | if (pf->long_offset) { | 759 | { |
761 | read (fd, tmp, 2); | 760 | bitmap_offset = tmp[0] | (tmp[1] << 8); |
762 | bitmap_offset |= (tmp[0] << 16) | (tmp[1] << 24); | 761 | if (pf->long_offset) { |
762 | if (read (fd, tmp, 2) == 2) | ||
763 | bitmap_offset |= (tmp[0] << 16) | (tmp[1] << 24); | ||
764 | } | ||
763 | } | 765 | } |
764 | } | 766 | } |
765 | else | 767 | else |