diff options
author | Chris Michael <cp.michael@samsung.com> | 2017-06-08 10:34:29 -0400 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2017-06-08 10:34:29 -0400 |
commit | 0ecf044080553da8ae149278cd4cc957ed8d559b (patch) | |
tree | b250e5e9c011759b411313747b919dddf161d8d2 /src/lib | |
parent | b7c7ce4ce0a6a6f87decdfc79cd53aa80bb13497 (diff) |
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.michael@samsung.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ecore_drm2/ecore_drm2_outputs.c | 4 |
1 files changed, 4 insertions, 0 deletions
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) | |||
306 | Ecore_Drm2_Output_Mode *mode; | 306 | Ecore_Drm2_Output_Mode *mode; |
307 | uint64_t refresh; | 307 | uint64_t refresh; |
308 | 308 | ||
309 | EINA_SAFETY_ON_NULL_RETURN_VAL(info, NULL); | ||
310 | EINA_SAFETY_ON_FALSE_RETURN_VAL((info->htotal > 0), NULL); | ||
311 | EINA_SAFETY_ON_FALSE_RETURN_VAL((info->vtotal > 0), NULL); | ||
312 | |||
309 | mode = calloc(1, sizeof(Ecore_Drm2_Output_Mode)); | 313 | mode = calloc(1, sizeof(Ecore_Drm2_Output_Mode)); |
310 | if (!mode) return NULL; | 314 | if (!mode) return NULL; |
311 | 315 | ||