|
|
|
|
|
by waffenklang
4662 days ago
|
|
I agree in the point that its the task of the fv-system to take care of this, and so its a flaw in it, if its necessary. imho,in this case it is a flaw, as the 'public' api function base64_encode wants the user to input pointer to 2 ptr to buffer with only for 1 given the length. and the code makes implicit assumption of the user input without checking it (encoded is manipulated). |
|
The way it works is that they choose fixed sizes INLEN and OUTLEN, and prove that when data points to a buffer of INLEN bytes, they can allocate a result buffer and base64_encode(data, INLEN, result) will compute the correct encoding.
So, implied in this statement is the fact that the input buffer is valid (thus not null), and that the output buffer must be valid (and not null) and disjoint from the input buffer.
There are more fundamental classes of bugs that this won't detect:
- behavior for arbitrary sizes, such as integer overflows for large sizes
- bugs when using particular functions of the API, such as base64_encode_update()
The latter problem means that there is no proof that b64enc.c is correct at all, even for a fixed size: it's entirely possible that multiple calls to base64_encode_update() would corrupt the internal state.