Notes |
|
|
This is because for some reason when SVGs are opened using libsvgtiny, the DTD specified in the header is opened as a normal file path:
00492 : NetSurf : o.k. = Open("http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd",OLD) = [0x16426BFE] [366442uS]
00493 : NetSurf : FAIL = ExamineObject(0x59FA6AC8) [83uS]
00494 : NetSurf : FAIL = IsInteractive("http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd")
00495 : NetSurf : FAIL = IsFileSystem("http:") [183uS]
00496 : NetSurf : FAIL = ExamineFH("") [61uS]
00497 : NetSurf : FAIL = Open("svg-framework.mod",OLD) = [0x00000000] [128uS]
00498 : NetSurf : ROOT = ParentOfFH(0x16426BFE) "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [46uS]
It reports "ok" here because I have http-handler installed which takes care of opening such paths through DOS. However, the DTD (if it is required at all) should be fetched from the network rather than treated as a disk-based file.
|
|
|
|
I think this is a libsvgtiny bug, as I vaguely recall it being mentioned previously in relation to my little svg2dr2d tool. |
|
|
(0000843)
|
Chris Young
|
2015-05-05 19:28
(Last edited: 2016-08-22 10:37) |
|
|
|
(0001390)
|
ChrisH
|
2016-08-22 13:08
|
|
FWIW, this problem still occurs in the latest builds of NetSurf. (At least I'm told the problem I have is caused by this bug.) |
|
|
|
I've implemented a partial fix in CI3682.
The entity reference handling was calling fopen on the location, which after some research, turns out to be wrong. The location provided is either absolute or relative to the base (current doc being parsed), and is always a URI once resolved so should be fetched from the network. file: URIs can be fetched with fopen, however relative paths still need resolving first, and certain NetSurf frontends need different handling on changing this URI to a valid filesystem path.
There is a POC in the chris/fetch-x-ent-ref branches, but it needs some serious testing and has an issue in that the parsing doesn't finish before libsvgtiny destroys the XML parser - so that needs fixing.
For now not fetching the external entities is better than reading a potentially dangerous unintended file. |
|
|
|
I've had to reverse my partial fix because it breaks the libdom tests.
**This needs fixing properly, it could be a potential security issue** |
|
|
|
I've suppressed the requester in CI3774, but the entity ref fetching is still broken so I'm leaving this open. |
|