mirror of git://gcc.gnu.org/git/gcc.git
re PR libobjc/11433 (Crash due to dereferencing null pointer when querying protocol)
PR 11433 gcc/testsuite: * objc.dg/proto-lossage-3.m: New test. libobjc: * Protocol.m (descriptionForInstanceMethod): Don't dereference instance_methods if it's NULL. (descriptionForClassMethod): Likewise for class_methods. From-SVN: r74137
This commit is contained in:
parent
bb9cfd0062
commit
75d3baee18
|
|
@ -1,3 +1,8 @@
|
||||||
|
2003-12-01 Zack Weinberg <zack@codesourcery.com>
|
||||||
|
|
||||||
|
PR 11433
|
||||||
|
* objc.dg/proto-lossage-3.m: New test.
|
||||||
|
|
||||||
2003-12-01 Roger Sayle <roger@eyesopen.com>
|
2003-12-01 Roger Sayle <roger@eyesopen.com>
|
||||||
|
|
||||||
PR optimization/12628
|
PR optimization/12628
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* Crash due to descriptionFor(Instance|Class)Method applied to
|
||||||
|
a protocol with no instance/class methods respectively.
|
||||||
|
Problem report and original fix by richard@brainstorm.co.uk. */
|
||||||
|
/* { dg-do run } */
|
||||||
|
#include <objc/objc.h>
|
||||||
|
#include <objc/Object.h>
|
||||||
|
#include <objc/Protocol.h>
|
||||||
|
|
||||||
|
@protocol NoInstanceMethods
|
||||||
|
+ testMethod;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@protocol NoClassMethods
|
||||||
|
- testMethod;
|
||||||
|
@end
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
[@protocol(NoInstanceMethods) descriptionForInstanceMethod: @selector(name)];
|
||||||
|
[@protocol(NoInstanceMethods) descriptionForClassMethod: @selector(name)];
|
||||||
|
[@protocol(NoClassMethods) descriptionForInstanceMethod: @selector(name)];
|
||||||
|
[@protocol(NoClassMethods) descriptionForClassMethod: @selector(name)];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
2003-12-01 Zack Weinberg <zack@codesourcery.com>
|
||||||
|
|
||||||
|
PR 11433
|
||||||
|
* Protocol.m (descriptionForInstanceMethod): Don't dereference
|
||||||
|
instance_methods if it's NULL.
|
||||||
|
(descriptionForClassMethod): Likewise for class_methods.
|
||||||
|
|
||||||
2003-10-24 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
|
2003-10-24 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
* Makefile.in (runtime-info.h): Remove -Wp.
|
* Makefile.in (runtime-info.h): Remove -Wp.
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ struct objc_method_description_list {
|
||||||
const char* name = sel_get_name (aSel);
|
const char* name = sel_get_name (aSel);
|
||||||
struct objc_method_description *result;
|
struct objc_method_description *result;
|
||||||
|
|
||||||
|
if (instance_methods)
|
||||||
for (i = 0; i < instance_methods->count; i++)
|
for (i = 0; i < instance_methods->count; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp ((char*)instance_methods->list[i].name, name))
|
if (!strcmp ((char*)instance_methods->list[i].name, name))
|
||||||
|
|
@ -107,6 +108,7 @@ struct objc_method_description_list {
|
||||||
const char* name = sel_get_name (aSel);
|
const char* name = sel_get_name (aSel);
|
||||||
struct objc_method_description *result;
|
struct objc_method_description *result;
|
||||||
|
|
||||||
|
if (class_methods)
|
||||||
for (i = 0; i < class_methods->count; i++)
|
for (i = 0; i < class_methods->count; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp ((char*)class_methods->list[i].name, name))
|
if (!strcmp ((char*)class_methods->list[i].name, name))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue