The wonders of C: - NULL pointer dereferences, - Invalid pointer arithmetic leading to SIGSEGV due to unmapped memory access, - Out-of-bounds reads and writes to stack, heap and static-based arrays, - Invalid free() calls, - Double free() calls over the same pointer, - Division errors, - Assertion failures, - Use of uninitialized memory. But hey, any good programmer always writes perfect C code.
Yeah, and you know, the Rust guys are actually doing some great work on making a language that solves some of these problems without giving up the advantages that make C programmers choose C. Meanwhile, you are just being snarky on a message board while using a whole stack of software that was built by the programmers whose work you are criticizing.
FFmpeg and a thousand fixes
131–140 of 150 posts
Re: FFmpeg and a thousand fixes
#132 * I presume all this infra is used for more than just ffmpeg so why this software specifically? Im conscious its included in everthing from web browsers to games. If this was an attack vector, its a BIG vector.
* 1121 (or whatever it was) is a curious number to make a post about. Why not at the 1k mark or 1250?
* Explicitly calling out use of an unpriv user to a readership likely already well versed in basic security practices but notorious for casually ignoring on personal machines
Google, blink twice if theyve got ya tied up in some legal requirement that you cant disclose.Re: FFmpeg and a thousand fixes
#133Earlier quoted context omitted.
If Java is somehow a problem, you can simply make a language without stack smashing but also without GC. Nobody has done this so far because nobody gives a shit about the fact that every program we use is full of remote code vulns and will never be fixed.
You haven't been reading all the Rust release announcement threads, have you?
But the OSs created with them weren't as fancy as UNIX was at the time, or used hardware more costly than the PDP-11.
Re: FFmpeg and a thousand fixes
#134The wonders of C: - NULL pointer dereferences, - Invalid pointer arithmetic leading to SIGSEGV due to unmapped memory access, - Out-of-bounds reads and writes to stack, heap and static-based arrays, - Invalid free() calls, - Double free() calls over the same pointer, - Division errors, - Assertion failures, - Use of uninitialized memory. But hey, any good programmer always writes perfect C code.
And yet, FFmpeg couldn't really have been written in anything else. A 5% difference in performance could be the difference between a 1080p video decoding in real time on a low powered device like a phone or a netbook and the video decoding slightly slower than real time. Improvements to FFmpeg made my old netbook work as a video player. I don't think I would have been able to use an FFmpeg-based player at all if it h…
For the remaining 95% of the code, since 1978 one could use Modula-2, Ada, Pascal dialects, SafeC and many other system programming languages.
Back in the early 80's, C compilers were as crap as any other system programming languages when generating code for home computers.
Re: FFmpeg and a thousand fixes
#135The wonders of C: - NULL pointer dereferences, - Invalid pointer arithmetic leading to SIGSEGV due to unmapped memory access, - Out-of-bounds reads and writes to stack, heap and static-based arrays, - Invalid free() calls, - Double free() calls over the same pointer, - Division errors, - Assertion failures, - Use of uninitialized memory. But hey, any good programmer always writes perfect C code.
> There were lots of dynamic allocations
This surprises me; a lot of codecs are specified in such as way as to not require dynamic allocation at all.
I hypothesise that if it was written in another language, we would just see bugs appear in a different form.
Re: FFmpeg and a thousand fixes
#136Earlier quoted context omitted.
Nearly all SIMD in ffmpeg/libav/x264 is just written in assembly. Back in the day, gcc's code generation for even x86 SIMD intrinsic functions was too poor to consider using it. (Plus x86's intrinsics are just plain ugly. It's easier to read asm.) As for the architecture-independent SIMD in GNU C, it's something, but not quite flexible enough. Even C is really not a good enough language to consider implementing this…
Isn't that what the restrict keyword is for?
Re: FFmpeg and a thousand fixes
#137Earlier quoted context omitted.
That is a compiler issue, not language. ISO/ANSI C also don't support SIMD, you have to go down to Assembly when writing portable code across C compilers.
Ya, it's definitely a language issue; barring super-intelligent compilers that can vectorize things on their own (which GCC does for certain cases), you need a means to express vectorizable operations. You don't need to work at the assembly level for this; you just need a language that can express vector operations in a way that doesn't require a compiler to solve the halting problem, and you need a compiler that kno…
map (uncurry (+)) (zip [1,2,3] [4,5,6])
I guess because of these standard functions and the fact that everything in Haskell is immutable and side effect free it should be comparably easy to do SIMD optimizations. It's only a guess, though.Re: FFmpeg and a thousand fixes
#138Re: FFmpeg and a thousand fixes
#139Earlier quoted context omitted.
This list of criticism is copied verbatim from the article's list of fixed bugs, not composed directly by the OP.
The snark, however, is wholly original.
"You will never find a programming language that frees you from the burden of clarifying your ideas."
Re: FFmpeg and a thousand fixes
#140The wonders of C: - NULL pointer dereferences, - Invalid pointer arithmetic leading to SIGSEGV due to unmapped memory access, - Out-of-bounds reads and writes to stack, heap and static-based arrays, - Invalid free() calls, - Double free() calls over the same pointer, - Division errors, - Assertion failures, - Use of uninitialized memory. But hey, any good programmer always writes perfect C code.
From one of the linked blogs containing details: > There were lots of dynamic allocations This surprises me; a lot of codecs are specified in such as way as to not require dynamic allocation at all. I hypothesise that if it was written in another language, we would just see bugs appear in a different form.
Exactly! Programming is hard to get right, no matter what the language. I hate these people who come along saying "hurr, durr, C sucks, project X should have been written in language Y!" All the while ignoring the facts that a) they can go and rewrite X in Y any time they like, and b) if it was written in Y, people would be bitching about issues with Y (eg, speed). Shortsightedness and lack of will to put your code where your mouth is are two of the most despicable traits a programmer can have.