
14 Dec
2006
14 Dec
'06
9:36 p.m.
Tilo Nitzsche wrote:
A quick fix for that would be to do a row.reserve(TIFFScanlineSize(_tp));
Most definitely not. The correct fix is to pass TIFFScanlineSize(_tp) to the vector's constructor. Writing more bytes than the vector's size, even if they have been reserved, is undefined behaviour and just might mess up the container's internal structure. OK, so I can't think of any implementation where it would ever do so, but it's the principle that matters: you do not write beyond a vector's size, even if the space has been allocated. Sebastian Redl