[infer] add arrayByAddingObject: to the list of methods asserting the parameters

Reviewed By: mbouaziz

Differential Revision: D6529090

fbshipit-source-id: fd282af
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent d3f4043bc0
commit 83118865aa

@ -45,7 +45,8 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
let is_objc_container_add_method : Typ.Procname.t -> bool =
let method_prefixes =
[ "arrayWithObjects:"
; "arrayWithObjects:count:"
; "arrayWithObjects:"
; "arrayByAddingObject:"
; "dictionaryWithObjectsAndKeys:"
; "initWithObjectsAndKeys:"
; "dictionaryWithObjects:" ]
@ -262,4 +263,3 @@ let checker {Callbacks.summary; proc_desc; tenv} =
let proc_data = ProcData.make proc_desc tenv summary in
ignore (Analyzer.compute_post proc_data ~initial) ;
summary

@ -193,4 +193,9 @@ int* __nullable returnsNull();
return dict;
}
- (NSArray*)createArrayByAddingNilBad {
NSArray* array = @[ [NSObject alloc] ];
return [array arrayByAddingObject:[self nullableMethod]];
}
@end

@ -4,6 +4,8 @@ codetoanalyze/objc/checkers/Nullable.m, T_URLWithStringOkay, 2, DEAD_STORE, [Wri
codetoanalyze/objc/checkers/Nullable.m, T_URLWithStringOkay, 2, NULL_DEREFERENCE, [start of procedure URLWithStringOkay,Skipping URLWithString:: function or method not found]
codetoanalyze/objc/checkers/Nullable.m, T_assignNonnullFieldToNullBad, 1, FIELD_SHOULD_BE_NULLABLE, [Field nonnullField is assigned null here]
codetoanalyze/objc/checkers/Nullable.m, T_assignUnnanotatedFieldToNullBad, 1, FIELD_SHOULD_BE_NULLABLE, [Field unnanotatedField is assigned null here]
codetoanalyze/objc/checkers/Nullable.m, T_createArrayByAddingNilBad, 2, NULLABLE_DEREFERENCE, [dereferencing the return of nullableMethod,assignment of the nullable value,definition of nullableMethod]
codetoanalyze/objc/checkers/Nullable.m, T_createArrayByAddingNilBad, 2, NULL_DEREFERENCE, [start of procedure createArrayByAddingNilBad,start of procedure nullableMethod,return from a call to T_nullableMethod]
codetoanalyze/objc/checkers/Nullable.m, T_dereferenceNullableFieldBad, 1, NULL_DEREFERENCE, [start of procedure dereferenceNullableFieldBad]
codetoanalyze/objc/checkers/Nullable.m, T_dereferenceNullableFunctionBad, 2, NULLABLE_DEREFERENCE, [dereference of &p,assignment of the nullable value,definition of returnsNull]
codetoanalyze/objc/checkers/Nullable.m, T_dereferenceNullableFunctionBad, 2, NULL_DEREFERENCE, [start of procedure dereferenceNullableFunctionBad,Skipping returnsNull(): function or method not found]

Loading…
Cancel
Save