[x265] [PATCH] api: fix for crash in x265_api_query caused by function type casting error
albert.j.wang at gmail.com
albert.j.wang at gmail.com
Tue Jun 2 11:23:46 CEST 2015
# HG changeset patch
# User awang <albert.wang at harmonicinc.com>
# Date 1433236884 -28800
# Tue Jun 02 17:21:24 2015 +0800
# Node ID 3152f79525bbd4b71c82eea16c4cdd4c69b06473
# Parent 0f0d88319f7cc96661eef3c3dcc1befcf60354f3
api: fix for crash in x265_api_query caused by function type casting error
In x265_api_query, after retrieving the function pointer of x265_api_query from
external DLL, it is then incorrectly type cast into x265_api_get function, the
patch is intended for this fix.
diff -r 0f0d88319f7c -r 3152f79525bb source/encoder/api.cpp
--- a/source/encoder/api.cpp Tue Jun 02 12:35:53 2015 +0530
+++ b/source/encoder/api.cpp Tue Jun 02 17:21:24 2015 +0800
@@ -286,6 +286,7 @@
};
typedef const x265_api* (*api_get_func)(int bitDepth);
+typedef const x265_api* (*api_query_func)(int bitDepth, int apiVersion, int* err);
#define xstr(s) str(s)
#define str(s) #s
@@ -383,18 +384,18 @@
if (h)
{
e = X265_API_QUERY_ERR_FUNC_NOT_FOUND;
- api_get_func get = (api_get_func)GetProcAddress(h, method);
- if (get)
- api = get(0);
+ api_query_func query = (api_query_func)GetProcAddress(h, method);
+ if (query)
+ api = query(bitDepth,apiVersion,err);
}
#else
void* h = dlopen(libname, RTLD_LAZY | RTLD_LOCAL);
if (h)
{
e = X265_API_QUERY_ERR_FUNC_NOT_FOUND;
- api_get_func get = (api_get_func)dlsym(h, method);
- if (get)
- api = get(0);
+ api_query_func query = (api_query_func)dlsym(h, method);
+ if (query)
+ api = query(bitDepth,apiVersion,err);
}
#endif
More information about the x265-devel
mailing list