Fix off-by-one false positive in maxavro
The float and double types were calculated to exceed the internal buffer sizes even though the buffer was of the correct size.
This commit is contained in:
parent
809dea34e0
commit
902013e4f8
@ -246,12 +246,17 @@ bool maxavro_read_float(MAXAVRO_FILE* file, float *dest)
|
||||
{
|
||||
bool rval = false;
|
||||
|
||||
if (file->buffer_ptr + sizeof(*dest) < file->buffer_end)
|
||||
if (file->buffer_ptr + sizeof(*dest) <= file->buffer_end)
|
||||
{
|
||||
memcpy(dest, file->buffer_ptr, sizeof(*dest));
|
||||
file->buffer_ptr += sizeof(*dest);
|
||||
rval = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss_dassert(!true);
|
||||
MXS_ERROR("Block cannot hold a value of type float");
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
@ -280,12 +285,17 @@ bool maxavro_read_double(MAXAVRO_FILE* file, double *dest)
|
||||
{
|
||||
bool rval = false;
|
||||
|
||||
if (file->buffer_ptr + sizeof(*dest) < file->buffer_end)
|
||||
if (file->buffer_ptr + sizeof(*dest) <= file->buffer_end)
|
||||
{
|
||||
memcpy(dest, file->buffer_ptr, sizeof(*dest));
|
||||
file->buffer_ptr += sizeof(*dest);
|
||||
rval = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss_dassert(!true);
|
||||
MXS_ERROR("Block cannot hold a value of type double");
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user