[MPlayer-dev-eng] [PATCH] Fix crashes when pthread_create fails

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Mar 6 21:49:17 EET 2018


On Sun, Mar 04, 2018 at 08:54:43AM +0100, Reimar Döffinger wrote:
> 
> 
> On 02.03.2018, at 15:34, Zhouyang Jia <jiazhouyang09 at gmail.com> wrote:
> 
> > Hi,
> > 
> > I'm a PhD student. I analyzed the mplayer source code and found
> > pthread_create missing error handling in several places, which may
> > cause bad results like crash.
> > 
> > I think it's unsafe to assume the library function would be correct.
> > It would be better if we could handle the error properly.
> 
> I haven't checked the surrounding code so I might definitely be wrong, but I find it unlikely that just returning 0 will result in correct error handling.
> I'd expect som memory deallocation and error handling in higher level function would be necessary, did you check?
> Or trigger the error paths manually and run in valgrind?
> 
> Thanks for the patch either way though!

The first one seems fine.
The second seems like no improvement, should result in infinite hangs either way.
The message is useful, but I think the return is not.
The last one will result in pthread_create being called over
and over, probably 100s of times per second, all the while
producing the error message and garbage frames output.
As-is I don't think that one is an improvement.

Regards,
Reimar Döffinger


More information about the MPlayer-dev-eng mailing list