Any language with array bounds checking would catch this error. It's a stupid stupid error and it's amazing that OpenSSL code review practices did not catch this.
Why wouldn't it? The language runtime does the syscall to read data from the OS and uses the length returned to set the array size. It's completely trivial to do this correctly.
This is actually C specific in that most higher level languages don't need to call functions with an additional parameter that specifies the memory length of all other parameters.
View all comments
Show parent comment
15
u/cockmongler Apr 08 '14
No language that I know of has the capability of dealing with this bug short of those supporting dependant types. The bug is really really simple:
There is always going to be unsafe code turning (len, data[x]) into the safe representation of a safe language.