kmsdrm: merge heap buffer overflow and cursor creation patches from meyraud705.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/video/kmsdrm/SDL_kmsdrmmouse.c
index 0ead2e6..15ddf70 100644
--- a/src/video/kmsdrm/SDL_kmsdrmmouse.c
+++ b/src/video/kmsdrm/SDL_kmsdrmmouse.c
@@ -140,7 +140,7 @@ KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
goto cleanup;
}
- if (usable_cursor_w == 0 || usable_cursor_w == 0) {
+ if (usable_cursor_w == 0 || usable_cursor_h == 0) {
SDL_SetError("Could not get an usable GBM cursor size");
goto cleanup;
}
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index a3efa51..2ce3cd4 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -536,7 +536,7 @@ setup_plane(_THIS, struct plane **plane, uint32_t plane_type)
uint32_t plane_id;
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
- *plane = SDL_calloc(1, sizeof(*plane));
+ *plane = SDL_calloc(1, sizeof(**plane));
/* Get plane ID. */
plane_id = get_plane_id(_this, plane_type);
@@ -554,7 +554,7 @@ setup_plane(_THIS, struct plane **plane, uint32_t plane_type)
(*plane)->plane->plane_id, DRM_MODE_OBJECT_PLANE);
(*plane)->props_info = SDL_calloc((*plane)->props->count_props,
- sizeof((*plane)->props_info));
+ sizeof(*(*plane)->props_info));
for (unsigned int i = 0; i < (*plane)->props->count_props; i++) {
(*plane)->props_info[i] = KMSDRM_drmModeGetProperty(viddata->drm_fd,
@@ -1291,7 +1291,7 @@ KMSDRM_VideoInit(_THIS)
dispdata->crtc->crtc->crtc_id, DRM_MODE_OBJECT_CRTC);
dispdata->crtc->props_info = SDL_calloc(dispdata->crtc->props->count_props,
- sizeof(dispdata->crtc->props_info));
+ sizeof(*dispdata->crtc->props_info));
for (unsigned int i = 0; i < dispdata->crtc->props->count_props; i++) {
dispdata->crtc->props_info[i] = KMSDRM_drmModeGetProperty(viddata->drm_fd,
@@ -1303,7 +1303,7 @@ KMSDRM_VideoInit(_THIS)
dispdata->connector->connector->connector_id, DRM_MODE_OBJECT_CONNECTOR);
dispdata->connector->props_info = SDL_calloc(dispdata->connector->props->count_props,
- sizeof(dispdata->connector->props_info));
+ sizeof(*dispdata->connector->props_info));
for (unsigned int i = 0; i < dispdata->connector->props->count_props; i++) {
dispdata->connector->props_info[i] = KMSDRM_drmModeGetProperty(viddata->drm_fd,