This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit b4a5c5784248500013355972b4c1421cededb8ef
Author: rongyichang <[email protected]>
AuthorDate: Tue May 27 15:41:26 2025 +0800

    drivers/video/goldfish_gpu_fb: Cast stride to size_t before multiplication
    
    planeinfo.stride and videoinfo.yres are both 16-bit, so their product is
    computed in int and can overflow before being converted to the size_t
    size argument. Cast stride to size_t so the multiplication is done in
    size_t.
    
    Reported by Coverity (sign extension).
    
    Signed-off-by: rongyichang <[email protected]>
---
 drivers/video/goldfish_gpu_fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/goldfish_gpu_fb.c b/drivers/video/goldfish_gpu_fb.c
index 9ce70ad1c45..16fcff4a03b 100644
--- a/drivers/video/goldfish_gpu_fb.c
+++ b/drivers/video/goldfish_gpu_fb.c
@@ -383,7 +383,7 @@ static int goldfish_gpu_fb_commit(FAR struct 
goldfish_gpu_fb_s *fb,
                                            fb->colorformat,
                                            fb->colortype,
                                            buf,
-                                           fb->planeinfo.stride
+                                           (size_t)fb->planeinfo.stride
                                            * fb->videoinfo.yres);
   if (ret < 0)
     {

Reply via email to