FasterXML / aalto-xml

Ultra-high performance non-blocking XML processor (Stax API + extensions)
Apache License 2.0
292 stars 70 forks source link

`Attributes.getValue(String qName)` sometimes returns values from previous elements #80

Open nedtwigg opened 1 year ago

nedtwigg commented 1 year ago

I have an entity with no attributes. But getValue("SomeKey") is returning a value from a previous element.

I think the problem is that these lines

https://github.com/FasterXML/aalto-xml/blob/0820590fcf56ec3d5ca14608d6145e14e56f2650/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java#L654-L666

Are missing the || index >= _attrCount that this has

https://github.com/FasterXML/aalto-xml/blob/0820590fcf56ec3d5ca14608d6145e14e56f2650/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java#L647-L652

cowtowncoder commented 4 months ago

@nedtwigg Apologies for somehow missing this report. I don't know if it'd be possible, but I'd really like a reproduction (I assume "entity" in report means "element") to fix the problem.

I can try to build something on my end based on description and see how that goes; but may need help.

cowtowncoder commented 4 months ago

Ok, no. I do need a test case here to reproduce the problem. And I think the issue is with lookup, not bounds checks; some state is not being cleared, likely.

nedtwigg commented 4 months ago

The thing I was using this for is still alive, but not currently under active development. I did a quick git log to look at the context from 2 years ago, and I can see the workaround in our codebase, but I can't quickly identify a reproducer testcase. I expect this project will become active again sometime in the next few months. When that happens, I'll provide the data here.

cowtowncoder commented 4 months ago

@nedtwigg understood. Thank you for all help you can give.