Nul charref in element content does not throw error

Bug #1130998 reported by Chris Hillery
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Confirmed
Medium
Nicolae Brinza

Bug Description

The following query:

<elem>&#0;</elem>

should throw XQST0090 because character 0 (NUL) is not legal in XML. However, it succeeds and returns the element with a NUL character in the content. eg, on Linux,

% bin/zorba -f -q /tmp/bar.xq |cat -vet
<?xml version="1.0" encoding="UTF-8"?>$
<elem>^@</elem>

where ^@ is how "cat -vet" displays NUL characters.

This is causing the FOTS case prod-DirElemContent/Constr-cont-charref-2 to fail (or at least it will after the latest FOTS driver changes are merged - currently this bug was being hidden by a different bug).

Tags: fots hotlist

Related branches

Chris Hillery (ceejatec)
Changed in zorba:
importance: Undecided → Medium
milestone: none → 2.9
Revision history for this message
Chris Hillery (ceejatec) wrote :

As a note, Zorba *does* throw XQST0090 when &#x0; appears in a single literal:

% bin/zorba -q '"&#x0;"'
<.>:1,2: static error [err:XQST0090]: "Invalid XML v1.0 codepoint in the string literal ""&#x0;""": invalid character reference in XML ; raised at /home/ceej/zo/src/src/compiler/api/compiler_api.cpp:201

Changed in zorba:
assignee: nobody → Luis Rodriguez Gonzalez (kuraru)
tags: added: hotlist
Revision history for this message
Chris Hillery (ceejatec) wrote :

Luis - this is totally outside your areas of expertise, I realize, but would you mind taking a crack at it anyway? Might help you learn a bit about some other parts of Zorba.

Changed in zorba:
status: New → In Progress
Changed in zorba:
status: In Progress → Won't Fix
status: Won't Fix → In Progress
Changed in zorba:
assignee: Luis Rodriguez Gonzalez (kuraru) → Nicolae Brinza (nbrinza)
Revision history for this message
Luis Rodriguez Gonzalez (kuraru) wrote :

Just as a pointer, after checking the code generated by Flex, we found a function that we initially thought should manage the problem we are currently have, there is a function called checkXmlRefs, the problem is that the test case that is included in the defect never touches that code, Chris found that this code is only executed for StringLiteral token but not in the case where the charref is enclosed in an element, so my guest is that there should be a way to mnodiy the Grammar rules so checkXmlRefs gets call in that case too. Also the same problem happens when the nul-charref is included as a Attribute so I assume the solution should be similar to this one.

Chris Hillery (ceejatec)
Changed in zorba:
milestone: 2.9 → 3.0
Chris Hillery (ceejatec)
Changed in zorba:
status: In Progress → Confirmed
milestone: 3.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.