mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Fix to prevent crash (raise exception instead) when deserializing a corrupt file
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21379 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
750130f0e6
commit
9b8bcaa3e6
2 changed files with 19 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
2005-06-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSSerializer.m: deserializeFromInfo() check that cross
|
||||
reference indices are valid and raise an exception if not ... should
|
||||
fix bug reported by Roland Schwingel, where trying to deserialize a
|
||||
corrupt file could cause a crash.
|
||||
|
||||
2005-06-28 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/NSInvocation.m (-getReturnValue:, -setReturnValue:): Only
|
||||
|
|
|
@ -520,7 +520,9 @@ static void
|
|||
endDeserializerInfo(_NSDeserializerInfo* info)
|
||||
{
|
||||
if (info->didUnique)
|
||||
GSIArrayEmpty(&info->array);
|
||||
{
|
||||
GSIArrayEmpty(&info->array);
|
||||
}
|
||||
}
|
||||
|
||||
static id
|
||||
|
@ -536,7 +538,15 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
case ST_XREF:
|
||||
{
|
||||
size = (*info->deiImp)(info->data, deiSel, info->cursor);
|
||||
return RETAIN(GSIArrayItemAtIndex(&info->array, size).obj);
|
||||
if (size < GSIArrayCount(&info->array))
|
||||
{
|
||||
return RETAIN(GSIArrayItemAtIndex(&info->array, size).obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Bad cross reference in property list"];
|
||||
}
|
||||
}
|
||||
|
||||
case ST_CSTRING:
|
||||
|
|
Loading…
Reference in a new issue