[Expat-discuss] Expat and Open Watcom

Michael Greene greenemk at cox.com
Wed Jun 28 02:57:43 CEST 2006

Michael Greene wrote:
> Karl Waclawek wrote:
>> Michael Greene wrote:
>>> Karl,
>>> The source of my "out of memory" errors when running XML_TEST_SUITE 
>>> are due to the test file size and using readfilemap.c. The test suite 
>>> files are size 0, so malloc( 0 ) returns NULL and I get a false "out 
>>> of memory" error. I assume that any build that uses readfilemap.c 
>>> would have this return. Would it be better to do this:
>>>    nbytes = sb.st_size;
>>> +  if(nbytes == 0) {
>>> +    close(fd);
>>> +    return 1;
>>> +  }
>>>    p = malloc(nbytes);
>>>    if (!p) {
>>> +    close(fd);
>>>      return 0;
>>>    }
>>> So that nbytes is checked for 0 size and return 1 ?
>>> With this change and a couple other defines I am at:
>>> Passed: 1773
>>> Failed: 37
>> That sounds pretty good!
>> Would you please file a bug report for readfilemap.c?
>> I'll then commit your patch.
>> Thanks,
>> Karl
> Submitted #1513566 - sorry about the WATCOM define include.
> MikeG


Just as a side note I compiled expat 2.0.0 with my linux system to 
verify my Open Watcom build results. Good news my Open Watcom version 
only gives me these additional errors over the linux - gcc build:

Output differs: xmltest/valid/sa/069.xml
Output differs: xmltest/valid/sa/076.xml
Output differs: xmltest/valid/sa/090.xml
Output differs: xmltest/valid/sa/091.xml

However, the linux - gcc build had these errors (not in order):

003.ent: Invalid argument
In xmltest/valid/ext-sa/: 003.xml:5:5: error in processing external 
entity reference

010.ent: Invalid argument
In xmltest/valid/ext-sa/: 010.xml:5:5: error in processing external 
entity reference

001.ent: Invalid argument
In xmltest/valid/not-sa/: 001.xml:3:1: error in processing external 
entity reference

003-2.ent: Invalid argument
In xmltest/valid/not-sa/: 003-1.ent:3:23: error in processing external 
entity reference

null.ent: Invalid argument
In sun/valid/: ext01.xml:9:21: error in processing external entity reference

p31pass1.dtd: Invalid argument
In oasis/: p31pass1.xml:1:58: error in processing external entity reference

050.xml: Invalid argument

Expected well-formed: oasis/p39fail3.xml

Reason I call this out is because I think it is the same problem in 
unixfilemap.c. The mmap( ) returns failed because of zero file size when 
it should have a check like readfilemap.c (my fix) and win32filemap.c. 
It is rare for me to start linux and just as rare to use gcc.


More information about the Expat-discuss mailing list