Sanity check: assert that row buffer length is not exceeded at a proper time, instead of dereferencing a broken pointer later on, which has random consequences (given that range checking is off).

This commit is contained in:
rosenfield.albert
2008-05-27 14:16:36 +00:00
parent 88d25c902d
commit 1e31edc0c0

View File

@@ -231,6 +231,10 @@ begin
FColumnLengths[I] := GetColumnSize(Current);
FColumnOffsets[I] := FColumnsSize;
Inc(FColumnsSize, FColumnLengths[I] + 1);
// 32768 is the length of a TByteArray.
if FColumnsSize > 32767 then begin
raise Exception.Create('Zeos: Row buffer width exceeded.\nTry using fewer or longer columns in SQL query.');
end;
FHasBlobs := FHasBlobs
or (FColumnTypes[I] in [stAsciiStream, stUnicodeStream, stBinaryStream]);
end;