Discussion:
[jira] [Created] (XALANJ-2606) A suspicious use of an incrementer in a for loop
JC (JIRA)
2017-02-02 21:12:51 UTC
Permalink
JC created XALANJ-2606:
--------------------------

Summary: A suspicious use of an incrementer in a for loop
Key: XALANJ-2606
URL: https://issues.apache.org/jira/browse/XALANJ-2606
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
Reporter: JC
Assignee: Steven J. Hathaway
Priority: Trivial


In a recent github snapshot, I've found a suspicious use of an incrementer in for loop.

src/org/apache/xalan/xsltc/compiler/util/MethodGenerator.java
{code:java}
501 for (int i = 0; i < slotCount; i++) {
502 Object slotEntries = _variables.get(i);
503 if (slotEntries != null) {
504 if (slotEntries instanceof ArrayList) {
505 ArrayList slotList = (ArrayList) slotEntries;
506
507 for (int j = 0; j < slotList.size(); j++) {
508 allVarsEverDeclared.add(slotList.get(i));
509 }
510 } else {
511 allVarsEverDeclared.add(slotEntries);
512 }
513 }
514 }
{code}

In Line 508, slotList.get( i) should be slotList.get(j)? I have no idea if slotCount is always same as or less than slotList.size(). However, I thought it's worth to report just in case.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org

Loading...