This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch to fix libobjc crash



If you compile the following test program using the command 'gcc test.m -lobjc'
Then run a.out, and you will get a segmentation violation.


This is because TestProtocol contains only a class method, but we tried to look
up an instance method ... the lookup should have returned a null pointer rather
than crashing.


Test program ...

#include        <objc/objc.h>
#include        <objc/Object.h>
#include        <objc/Protocol.h>

@protocol TestProtocol
+ testMethod;
@end

int
main()
{
[@protocol(TestProtocol) descriptionForInstanceMethod: @selector(name)];
return 0;
}





ChangeLog ...


2003-07-04 Richard Frith-Macdonald <richard@brainstorm.co.uk>

* libobjc/Protocol.m: Avoid dereferencing null pointer in order to prevent
crashes. Fixes PR libobjc/11433



Attachment: Protocol.m.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]