[PATCH] Fix crash in CheckObjCCircularContainer
AlexDenisov
1101.debian at gmail.com
Thu Jul 30 01:05:20 PDT 2015
The patch is a simplest fix for crash when CheckObjCCircularContainer
applies to a message to a ’super’, e.g.:
@implementation Foo : NSMutableArray
- foo {
[super addObject:nil];
}
@end
This is, probably, not a proper fix for the problem,
but initial patch wasn’t intended to apply checks to any kind
of subclassing, because it, imho, over-complicates implementation:
This particular problem touches subclassing from a class-cluster,
which means that the concrete subclass will have some backing storage, e.g.:
@implementation FootableArray : NSMutableArray
{
NSMutableArray *_backingStorage;
}
- addObject:(id)object {
[_backingStorage addObject:object];
}
@end
In this case even adding `self` to `self` would not lead to a circular container:
- foo {
[self addObject:self]; // puts `self` into the `_backingStorage`
}
I would apply this patch as is and postpone a ‘proper and bullet-proof implementation’
when I, or somebody who is also interested, will have more time.
If there are any questions/suggestions/objections - let’s discuss them.
--
AlexDenisov
Software Engineer, http://lowlevelbits.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_circular_container_crash.patch
Type: application/octet-stream
Size: 1034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150730/b7e0c7ad/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150730/b7e0c7ad/attachment.sig>
More information about the cfe-commits
mailing list