History

avcodec/libx265: Pass logctx as void*, not AVClass**

The latter need not be save, because av_log() expects to get a pointer to an AVClass-enabled structure and not only a fake object. If this function were actually be called in the following way: const AVClass *avcl = avctx->av_class; handle_mdcv(&avcl, ); the AVClass's item_name would expect to point to an actual AVCodecContext, potentially leading to a segfault.

Andreas Rheinhardt committed 2 years ago

Commit b9fcc131 parent 244db711 file · +3 −3Browse files

Unified · Split

libavcodec/libx265.c+3−3
@@ -175,7 +175,7 @@ static av_cold int libx265_param_parse_int(AVCodecContext *avctx, · 174 unmodified lines
175175 return 0;
176176 }
177177
178−static int handle_mdcv(const AVClass **avcl, const x265_api *api,
178+static int handle_mdcv(void *logctx, const x265_api *api,
179179 x265_param *params,
180180 const AVMasteringDisplayMetadata *mdcv)
181181 {
@@ -198,7 +198,7 @@ static int handle_mdcv(const AVClass **avcl, const x265_api *api, · 16 unmodified lines
198198
199199 if (api->param_parse(params, "master-display", buf) ==
200200 X265_PARAM_BAD_VALUE) {
201− av_log(avcl, AV_LOG_ERROR,
201+ av_log(logctx, AV_LOG_ERROR,
202202 "Invalid value \"%s\" for param \"master-display\".\n",
203203 buf);
204204 return AVERROR(EINVAL);
@@ -230,7 +230,7 @@ static int handle_side_data(AVCodecContext *avctx, const x265_api *api, · 25 unmodified lines
230230
231231 if (mdcv_sd) {
232232 int ret = handle_mdcv(
233− &avctx->av_class, api, params,
233+ avctx, api, params,
234234 (AVMasteringDisplayMetadata *)mdcv_sd->data);
235235 if (ret < 0)
236236 return ret;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t