[xml] hash.c: problem and patch



Hi Daniel, All,

Some days ago I wrote, that using Watcom C on Win32, validating 
(xmllint --valid) segfaults, but only when compiled without debugging info.

I was wondering since then whether the compiler or the code is to blame. 
I still don't know the answer to this question, but I know the cause of the 
segfaulting and I have a patch.

The problem is the casting of a callback function to a different signature 
in xmlHashScanner:

  xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) {
!     xmlHashScanFull (table, (xmlHashScannerFull) f, data);
  }

I'm pretty sure the C++ standard sees this as cause of undefined 
behaviour, but I don't know whether written or unwritten C rules require a 
compiler to handle this.

Anyway, I've attached a patch which avoids this cast by using a stub 
function with the right signature. Strictly speaking, it's not completely 
kosher, as it still requires casting away a const modifier.

Regards,
Peter Jacobi

Attachment: hash.c.diff.gz
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]