ProgQuery is a system to extract useful syntactic and semantic information from source code programs and store it in a graph database for posterior querying.
MIT License
15
stars
4
forks
source link
Anonymous classes mutating parameters from outer method cause NullPointerException during Interprocedural analysis #30
The method has no parameters.
The method makes a call with an outer parameter from a method outside the anonymous class.
After getting declarations from expressions, paramsToPDGRelations in MethodInfo class is empty.
Before Interprocedural analysis the info of the method (paramsToPDGRelations in MethodInfo class) is empty.
After Interprocedural analysis, the info of the method an outsider parameter is added to its info.
Since the parameter (with index 1 in its method) does not belong to the method being analyzed and this method has no parameters, when PQ tries to get info for this param index from invocationsMayModifyVars, we get a NullPointerException.
We plan to control not to add any outsider parameter to the paramsToPDGRelations info of the method to prevent this NullPointer but...
When the call over the parameter is added to the invocationsMayModifyVars?
Can we prevent adding such calls over outsider parameters...? NO! we need that info to complete the PDG
The method has no parameters. The method makes a call with an outer parameter from a method outside the anonymous class. After getting declarations from expressions, paramsToPDGRelations in MethodInfo class is empty. Before Interprocedural analysis the info of the method (paramsToPDGRelations in MethodInfo class) is empty. After Interprocedural analysis, the info of the method an outsider parameter is added to its info. Since the parameter (with index 1 in its method) does not belong to the method being analyzed and this method has no parameters, when PQ tries to get info for this param index from invocationsMayModifyVars, we get a NullPointerException. We plan to control not to add any outsider parameter to the paramsToPDGRelations info of the method to prevent this NullPointer but... When the call over the parameter is added to the invocationsMayModifyVars? Can we prevent adding such calls over outsider parameters...? NO! we need that info to complete the PDG
example: https://github.com/classgraph/classgraph.git