devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=0ecf044080553da8ae149278cd4cc957ed8d559b

commit 0ecf044080553da8ae149278cd4cc957ed8d559b
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Thu Jun 8 10:34:29 2017 -0400

    ecore-drm2: Fix potential SIGFPE when adding output mode
    
    If we receive bad crtc info from libdrm, then we could end up with a
    SIGFPE here due to division by zero if info h/v total are not set.
    
    @fix
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/lib/ecore_drm2/ecore_drm2_outputs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c 
b/src/lib/ecore_drm2/ecore_drm2_outputs.c
index a30d04e0b7..e760c02d74 100644
--- a/src/lib/ecore_drm2/ecore_drm2_outputs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c
@@ -306,6 +306,10 @@ _output_mode_add(Ecore_Drm2_Output *output, const 
drmModeModeInfo *info)
    Ecore_Drm2_Output_Mode *mode;
    uint64_t refresh;
 
+   EINA_SAFETY_ON_NULL_RETURN_VAL(info, NULL);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL((info->htotal > 0), NULL);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL((info->vtotal > 0), NULL);
+
    mode = calloc(1, sizeof(Ecore_Drm2_Output_Mode));
    if (!mode) return NULL;
 

-- 


Reply via email to