Avoiding buffer length checks before buffer access in C++ -
i have char*
buffer need decode db. buffer such if not null, it's big , contains integers , strings.
the buffer contain contents 4-byte integer length followed ascii string many characters long. it's followed 4-byte length , string of length, , on until reach end.
most of time buffer valid see buffer corrupted , segv. segv since length resulted in reading more bytes rest of buffer length.
i do not want put checks everywhere remaining buffer length before decoding. buffer fields 200 in number. check can provide here can me solve problem without overhead of if
checks?
Comments
Post a Comment