[FFmpeg-devel] [PATCH] Fix a segmentfault in libavutil/opencl.c
Michael Niedermayer
michaelni at gmx.at
Sun Apr 20 06:16:15 CEST 2014
On Sun, Apr 13, 2014 at 09:57:04PM +0800, Y.C. Liu wrote:
>
> opencl.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> 7199763f13633220bdc21b9c1dc8794e40719729 patch_libavutil_opencl_c.diff
> diff -Naur a/libavutil/opencl.c b/libavutil/opencl.c
> --- a/libavutil/opencl.c 2014-04-13 20:57:31.619635645 +0800
> +++ b/libavutil/opencl.c 2014-04-13 21:53:59.999519428 +0800
> @@ -168,8 +168,9 @@
>
> const char *av_opencl_errstr(cl_int status)
> {
> - int i;
> - for (i = 0; i < sizeof(opencl_err_msg); i++) {
> + int i,l;
> + l = sizeof(opencl_err_msg)/sizeof(OpenclErrorMsg);
> + for (i = 0; i < l; i++) {
this should be using FF_ARRAY_ELEMS()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140420/38f0cb81/attachment.asc>
More information about the ffmpeg-devel
mailing list