[INTERPRETER]

* BUG: Fix a possible bad serialization of arrays.
* BUG: Don't crash during the unserialisation of an array whose datatype has been incorrectly serialized. Raise an error instead.


git-svn-id: svn://localhost/gambas/trunk@8110 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2017-03-18 12:14:01 +00:00
parent 8f079935df
commit 1184d41881

View file

@ -1050,6 +1050,8 @@ void STREAM_read_type(STREAM *stream, TYPE type, VALUE *value)
STREAM_read(stream, &buffer._byte, 1);
type = (TYPE)buffer._byte;
if (type > T_OBJECT)
THROW(E_SERIAL);
size = read_length(stream);
@ -1392,8 +1394,12 @@ void STREAM_write_type(STREAM *stream, TYPE type, VALUE *value)
{
buffer._byte = 'A';
STREAM_write(stream, &buffer._byte, 1);
buffer._byte = (unsigned char)Min(T_OBJECT, array->type);
if (TYPE_is_object(array->type))
buffer._byte = T_OBJECT;
else
buffer._byte = (unsigned char)array->type;
STREAM_write(stream, &buffer._byte, 1);
write_length(stream, array->count);