embear-engineering / drm-framebuffer

A simple application which can be used to test a Linux DRM device
GNU General Public License v3.0
55 stars 21 forks source link

Use of initialized data can cause crash. #2

Closed stolk closed 1 year ago

stolk commented 1 year ago

I had a crash in release_framebuffer() when I try to use an unconnected connector.

Using valgrind, I tracked it down to the use of uninitialized data. I will provide a pull-request with a simple fix.

$ valgrind ./drm-framebuffer -d /dev/dri/card0 -c HDMI-A-1
==51253== Memcheck, a memory error detector
==51253== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==51253== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==51253== Command: ./drm-framebuffer -d /dev/dri/card0 -c HDMI-A-1
==51253== 
Could not find preferred resolution
==51253== Conditional jump or move depends on uninitialised value(s)
==51253==    at 0x10AF0E: release_framebuffer (framebuffer.c:49)
==51253==    by 0x10B523: get_framebuffer (framebuffer.c:189)
==51253==    by 0x10AE84: main (main.c:276)