From a9b38adc6a677ec23bf9bfd2c77ccfbe190da176 Mon Sep 17 00:00:00 2001 From: Tim Walker Date: Mon, 26 Feb 2018 01:02:03 +0100 Subject: libhb: fix parsing of filters' tunes. filter_param_get_entry() was using the preset count for bounds checking. --- libhb/param.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/libhb/param.c b/libhb/param.c index 764ea5820..90d2debc1 100644 --- a/libhb/param.c +++ b/libhb/param.c @@ -175,36 +175,40 @@ typedef struct int filter_id; hb_filter_param_t *presets; hb_filter_param_t *tunes; - int count; + int preset_count; + int tune_count; } filter_param_map_t; static filter_param_map_t param_map[] = { { HB_FILTER_NLMEANS, nlmeans_presets, nlmeans_tunes, - sizeof(nlmeans_presets) / sizeof(hb_filter_param_t) }, + sizeof(nlmeans_presets) / sizeof(hb_filter_param_t), + sizeof(nlmeans_tunes) / sizeof(hb_filter_param_t), }, { HB_FILTER_HQDN3D, hqdn3d_presets, NULL, - sizeof(hqdn3d_presets) / sizeof(hb_filter_param_t) }, + sizeof(hqdn3d_presets) / sizeof(hb_filter_param_t), 0, }, { HB_FILTER_UNSHARP, unsharp_presets, unsharp_tunes, - sizeof(unsharp_presets) / sizeof(hb_filter_param_t) }, + sizeof(unsharp_presets) / sizeof(hb_filter_param_t), + sizeof(unsharp_tunes) / sizeof(hb_filter_param_t), }, { HB_FILTER_LAPSHARP, lapsharp_presets, lapsharp_tunes, - sizeof(lapsharp_presets) / sizeof(hb_filter_param_t) }, + sizeof(lapsharp_presets) / sizeof(hb_filter_param_t), + sizeof(lapsharp_tunes) / sizeof(hb_filter_param_t), }, { HB_FILTER_DETELECINE, detelecine_presets, NULL, - sizeof(detelecine_presets) / sizeof(hb_filter_param_t) }, + sizeof(detelecine_presets) / sizeof(hb_filter_param_t), 0, }, { HB_FILTER_COMB_DETECT, comb_detect_presets, NULL, - sizeof(decomb_presets) / sizeof(hb_filter_param_t) }, + sizeof(decomb_presets) / sizeof(hb_filter_param_t), 0, }, { HB_FILTER_DECOMB, decomb_presets, NULL, - sizeof(decomb_presets) / sizeof(hb_filter_param_t) }, + sizeof(decomb_presets) / sizeof(hb_filter_param_t), 0, }, { HB_FILTER_DEINTERLACE, deinterlace_presets, NULL, - sizeof(deinterlace_presets) / sizeof(hb_filter_param_t) }, + sizeof(deinterlace_presets) / sizeof(hb_filter_param_t), 0, }, - { HB_FILTER_INVALID, NULL, NULL, 0 } + { HB_FILTER_INVALID, NULL, NULL, 0, 0, }, }; void hb_param_configure_qsv(void) @@ -949,7 +953,7 @@ filter_param_get_presets_internal(int filter_id, int *count) { if (count != NULL) { - *count = param_map[ii].count; + *count = param_map[ii].preset_count; } return param_map[ii].presets; } @@ -972,7 +976,7 @@ filter_param_get_tunes_internal(int filter_id, int *count) { if (count != NULL) { - *count = param_map[ii].count; + *count = param_map[ii].tune_count; } return param_map[ii].tunes; } -- cgit v1.2.3