render/drm_format_set: assert len <= cap when duplicating
This commit is contained in:
parent
06ab41a160
commit
8a6930c138
|
@ -128,6 +128,7 @@ bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_drm_format *wlr_drm_format_dup(const struct wlr_drm_format *format) {
|
struct wlr_drm_format *wlr_drm_format_dup(const struct wlr_drm_format *format) {
|
||||||
|
assert(format->len <= format->cap);
|
||||||
size_t format_size = sizeof(struct wlr_drm_format) +
|
size_t format_size = sizeof(struct wlr_drm_format) +
|
||||||
format->cap * sizeof(format->modifiers[0]);
|
format->cap * sizeof(format->modifiers[0]);
|
||||||
struct wlr_drm_format *duped_format = malloc(format_size);
|
struct wlr_drm_format *duped_format = malloc(format_size);
|
||||||
|
|
Loading…
Reference in New Issue