[ expat-Patches-551599 ] Patch for bugs # 483514, 544679, 548690

noreply@sourceforge.net noreply@sourceforge.net
Tue May 7 08:54:07 2002


Patches item #551599, was opened at 2002-05-02 16:38
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=310127&aid=551599&group_id=10127

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Karl Waclawek (kwaclaw)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch for bugs # 483514, 544679, 548690

Initial Comment:
This is an extensive patch, and needs not only 
testing, but also a review by my fellow developers!

It addresses these issues:

# 483514 (default handler reports too much from DTD):
    only the following data are reported now: 
    - ignored DTD sections
    - unhandled external parameter entity references
    - top level whitespace
    This may not be what is needed, but more would
    have been a lot of work

# 544679, 548690 (DTD handling of external entities): 
   - the storeEntityValue function has been modified
     to call the external entity reference handler, 
     since it did not handle external PE references
     at all
    - a new STRING_POOL has been added that gets
      passed from a parent to a child parser
     (member of DTD structure), so that entity values
      can be built across parsers 
    - new functions entityValueInitProcessor and 
      entityValueProcessor have been added
    - the old usage of dtd.complete was completely
      changed - I never understood how it worked,
      and it didn't work properly anyway;
      therefore there is a danger now that some logic
      will not work anymore - please review and check
    - the usage of hadExternalDoctype was modified too
    - there have been changes in xmlrole.c too - the
      chain of state handlers was extended from 
      entity9 to entity10 - in analogy to how general 
      entities - please review the diff file 
    - as a result, this patch now processes all
      of James Clark's test cases in the
      /valid/not-sa and /valid/ext-sa directories
      properly

* I have also made some fixes to the recently
  introduced XML_ParserReset function (incl. 
  changing it's return type), and one fix that
  prevents a null pointer error

The patch is based on these revisions:
- expat.h rev. 1.17
- xmlparse.c rev. 1.31
- xmlrole.c rev. 1.5
- xmlrole.h rev. 1.3

I have included the full patch files, 
an annotated version of xmlparse.c - good
to understand my changes, and the diff files.

Karl


----------------------------------------------------------------------

>Comment By: Karl Waclawek (kwaclaw)
Date: 2002-05-07 11:53

Message:
Logged In: YES 
user_id=290026

This is the second improvement and probably the final
version of the patch. If there should be more changes,
a new patch will be entered, since it might get confusing
otherwise.

The following changes have been made:

- some improvements on external PE reference handling
- a better fix (hopefully) for bug # 549014
- the changes to DefaultHandler calls for DTDs
  have been undone - I realized that more extensive
  changes (also to xmlrole.c and xmlrole.h) would be
  necessary, so the old behaviour is back: everything
  for DTDs is reported, even if handlers are set,
  except for PIs, Comments and XML text declarations.

This patch now applies to the following bugs:
- # 553318
- # 551852
- # 549014
- # 548690
- # 544679

Uploaded as files xmlparse_2.c and xmlparse_2.c.diff.

Karl

----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2002-05-04 13:13

Message:
Logged In: YES 
user_id=290026

I improved the patch to cover one more problem:
I found that bug # 551852 (BOM problem with small buffers),
that was reported for general external entities, also
applied to external parameter entities.

This problem only applied to this patch, since the current
release of Expat simply ignores external PEs (which causes
bug # 548690).

Included is also a fix for bug # 549014 (dtdCopy problem).

The attached file are xmlparse_1.c, xmlparse_1.c.annotated
and xmlparse_1.diff (against rev. 1.31).

Karl


----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2002-05-03 10:09

Message:
Logged In: YES 
user_id=290026

Forgot to add: the fix for bug # 551852 is included too.

Karl

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=310127&aid=551599&group_id=10127