Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
May 02, 2008 [Issue 2063] New: std.xml access violation for nested, closed tags | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2063 Summary: std.xml access violation for nested, closed tags Product: D Version: 2.013 Platform: PC OS/Version: Windows Status: NEW Severity: major Priority: P2 Component: Phobos AssignedTo: bugzilla@digitalmars.com ReportedBy: gaboonviper@gmx.net If a closed <node/> is written inside another node, an access violation occurs in the constructor of the xml document document. works: <?xml version="1.0"?><tag/> doesn't work: <?xml version="1.0"?><something><tag/></something> this was tested using the following setup: import std.stdio; import std.file; import std.xml; void main{ string s = cast(string)std.file.read("widget2.xml"); check(s); auto doc = new Document(s); writefln(doc); } Cheers, Boyd -- |
May 02, 2008 [Issue 2063] std.xml access violation for nested, closed tags | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2063 ------- Comment #1 from gide@nwawudu.com 2008-05-02 10:52 ------- Malformed XML also access violates. E.g. ---- <?xml version="1.0"?><widget> -- |
May 02, 2008 Re: [Issue 2063] New: std.xml access violation for nested, closed tags | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | OK, thanks. Will look into that one.
Janice
On 02/05/2008, d-bugmail@puremagic.com <d-bugmail@puremagic.com> wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=2063
>
> Summary: std.xml access violation for nested, closed tags
> Product: D
> Version: 2.013
> Platform: PC
> OS/Version: Windows
> Status: NEW
> Severity: major
> Priority: P2
> Component: Phobos
> AssignedTo: bugzilla@digitalmars.com
> ReportedBy: gaboonviper@gmx.net
>
>
> If a closed <node/> is written inside another node, an access violation occurs
> in the constructor of the xml document document.
>
> works:
> <?xml version="1.0"?><tag/>
>
> doesn't work:
> <?xml version="1.0"?><something><tag/></something>
>
> this was tested using the following setup:
>
> import std.stdio;
> import std.file;
> import std.xml;
>
> void main{
> string s = cast(string)std.file.read("widget2.xml");
>
> check(s);
>
> auto doc = new Document(s);
>
> writefln(doc);
> }
>
> Cheers,
> Boyd
>
>
>
> --
>
>
|
May 02, 2008 Re: [Issue 2063] std.xml access violation for nested, closed tags | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | OK, thanks. I will definitely investigate that.
Question: Is this in debug mode or release mode? If it's in a release build, it's not really a bug in std.xml, because you're not supposed to pass malformed XML to the parsing functions. (You call check() first, to make sure it's well formed). But if it's in a debug build, then it's definitely a bug in my code, because in that case, it should assert somewhere - ideally in an in contract.
Janice
On 02/05/2008, d-bugmail@puremagic.com <d-bugmail@puremagic.com> wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=2063
>
>
>
>
>
> ------- Comment #1 from gide@nwawudu.com 2008-05-02 10:52 -------
> Malformed XML also access violates.
>
> E.g.
> ----
> <?xml version="1.0"?><widget>
>
>
>
> --
>
>
|
May 03, 2008 [Issue 2063] std.xml access violation for nested, closed tags | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2063 ------- Comment #4 from gide@nwawudu.com 2008-05-03 11:55 ------- > Question: Is this in debug mode or release mode? Happens in both, the following code highlights the issue. [CODE] import std.stdio; import std.file; import std.xml; int main(){ try { string s1 = cast(string)std.file.read("widget.xml"); string s2 = q"[<?xml version="1.0"?><widget>]"; // print chars, s1 and s2 are the equal writeln(s1.length == s2.length); foreach (int i, char c; s1) { writeln(s1[i], ": ", s1[i] == s2[i]); } alias s1 testStr; // s1 Access Violation //alias s2 testStr; // As expected CheckException std.xml.check(testStr); auto doc = new std.xml.Document(testStr); writefln(doc); return 0; } catch (CheckException e) { writeln("XML: ", e.toString()); } catch (object.Exception e) { writeln("ERROR: ", e.toString()); } return 1; } [/CODE] -- |
May 03, 2008 Re: [Issue 2063] std.xml access violation for nested, closed tags | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | OK, thanks very much. Will fix.
Janice
On 03/05/2008, d-bugmail@puremagic.com <d-bugmail@puremagic.com> wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=2063
>
>
>
>
>
>
> ------- Comment #4 from gide@nwawudu.com 2008-05-03 11:55 -------
>
> > Question: Is this in debug mode or release mode?
>
> Happens in both, the following code highlights the issue.
>
> [CODE]
> import std.stdio;
> import std.file;
> import std.xml;
>
> int main(){
> try {
> string s1 = cast(string)std.file.read("widget.xml");
> string s2 = q"[<?xml version="1.0"?><widget>]";
>
> // print chars, s1 and s2 are the equal
> writeln(s1.length == s2.length);
> foreach (int i, char c; s1) {
> writeln(s1[i], ": ", s1[i] == s2[i]);
> }
>
> alias s1 testStr; // s1 Access Violation
> //alias s2 testStr; // As expected CheckException
> std.xml.check(testStr);
> auto doc = new std.xml.Document(testStr);
> writefln(doc);
>
> return 0;
> } catch (CheckException e) {
> writeln("XML: ", e.toString());
> } catch (object.Exception e) {
> writeln("ERROR: ", e.toString());
> }
> return 1;
> }
> [/CODE]
>
>
>
> --
>
>
|
May 07, 2008 [Issue 2063] std.xml access violation for nested, closed tags | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2063 caron800@googlemail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- |
May 22, 2008 [Issue 2063] std.xml access violation for nested, closed tags | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2063 ------- Comment #6 from bugzilla@digitalmars.com 2008-05-22 05:03 ------- Fixed dmd 2.014 -- |
Copyright © 1999-2021 by the D Language Foundation