[bitc-dev] bitc.stdio.read-byte/write-byte are broken

Thomas Kuehne thomas at kuehne.cn
Wed Dec 3 16:00:25 CST 2008


bitc_stdio_read_byte and bitc_stdio_write_byte check success via 
fread/fwrite < 0, however both have the return type size_t and thus 
the check never fails. It should be 1 instead of 0 in both cases.

In addition neither of them check if the file actually is open
(NULL == ios->f) and thus segfault if the stream has been closed.

Thomas


More information about the bitc-dev mailing list