[FFmpeg-devel] [PATCH] Fix a segmentfault in libavutil/opencl.c

Michael Niedermayer michaelni at gmx.at
Fri Apr 25 05:30:10 CEST 2014


On Tue, Apr 22, 2014 at 10:24:22PM +0800, Y.C. Liu wrote:
> 2014-04-20 12:16 GMT+08:00, Michael Niedermayer <michaelni at gmx.at>:
> > 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
> >
> 
> New patch attached.
> Using FF_ARRAY_ELEMS().
> Thanks.

>  opencl.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> a76d425f6b69b6516e9d7f247fa358e0df4900d4  patch_libavutil_opencl_c.diff
> diff -Naur a/libavutil/opencl.c b/libavutil/opencl.c

applied
thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- 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/20140425/7af79b22/attachment.asc>


More information about the ffmpeg-devel mailing list