[vlc-devel] [VLC] #2366: realloc is generally used incorrectly

Rémi Denis-Courmont remi at remlab.net
Mon May 25 18:32:08 CEST 2009


Le lundi 25 mai 2009 19:07:11 jpd at videolan.org, vous avez écrit :
> Something to document so that it can be fixed. Hear-say is worth a lot more
> with the backtraces to prove it. Trac is designed to keep track of that
> sort of thing with open tickets.

In retrospect, looking at the changes in the cache code, I'm not surprised it 
crashed. A single test run of VLC will trigger it.

> > If you call that "improve the code", then I'm afraid we have very much
> > incompatible standards.
>
> I didn't do any of the sort. However, I would appreciate constructive
> discussion instead.

I think I made the constructive comments yesterday and earlier. I gave up.

> > Do you think they will be happy when we have "fixed" all the realloc()
> > sites and they realize that VLC still crashes just as often (or even more
> > often  actually)? I think they will be even more pissed off with us (you
> > know, kind of like me with your employer)... and our code quality will
> > be yet worse.
>
> They will be happy to see us work on the issue instead of closing the
> ticket and for all appearances ignoring it. I am reasonably sure of this
> because they said so in the relevant ticket on their ticketing system.

Until they realize that the reasons why VLC crashes have little to do with not 
handling realloc() errors properly. That is not to deny that it is a bug, but 
*again*, that is most certainly not the primary reason why VLC crashes 
Mozilla. As for what the ticketing system says, I cannot comment because it 
was not made known to me or to this mailing list. I jsut assume that 1/ they 
are pissed off with the VLC crashiness which make their software look bad, and 
2/ fixing realloc() calls will not solve that problem.

> You are indeed right that coming up with good quality code does require
> care more than heated argument. The personal problems you still have to
> work out with him instead of taking it out on all and sundry.

That he would stops committing so much non-sense has nothing to do with *me*. 
I just happens to be the most noisy reviewer.

> > > I think j-b is doing a reasonable job of negotiating with them but he
> > > has to have something to work with, so leaving him no cards to play
> > > just doesn't do.
> >
> > And I think JPS does an unreasonable job, and leaving him his trunp card
> > to play will just make the situation ultimately worse.
>
> Is that then why you closed the ticket?

Five months ago? Every body should know that fixing realloc() errors is error-
prone (I think I was proven right today on this) and will have little to no 
effect on LibVLC stability. Also, I am not a big fan of meta-bugs. J-B said he 
wanted it open - that's OK to me. But rushing a crappy patchset to "fix" it, 
that's not OK.

A demand-paging operating system will hit OOM when memory is accessed, _not_ 
when memory is allocated. The C language provides no (portable) way to handle 
errors during memory accesses. Checking for realloc() errors will not fix out-
of-memory handling; it would however fix out-of-address-space handling (i.e. 
ridiculously large allocation requests), if and only if we were to fix 
malloc() and calloc() as well, including in all underlying libraries.

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list