HPCC-35955 Fix error parsing XML when deleting orphan file#21064
HPCC-35955 Fix error parsing XML when deleting orphan file#21064ghalliday merged 1 commit intohpcc-systems:candidate-9.14.xfrom
Conversation
|
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-35955 Jirabot Action Result: |
There was a problem hiding this comment.
Pull request overview
This PR addresses HPCC-35955 by adjusting how XRef XML content is read into a MemoryBuffer, aiming to prevent XML parsing errors when handling orphan file deletion scenarios in the Dali DFU XRef subsystem.
Changes:
- Changed
readXrefBranch()to allocate/read exactlyfileSizebytes (instead offileSize + 1) and removed explicit null-termination. - Left the rest of the XRef file-backed load path unchanged.
| if (fileSize < maxFileSize) | ||
| { | ||
| dst.ensureCapacity((size32_t)fileSize); | ||
| char *ptr = (char *)dst.reserveTruncate((size32_t)fileSize+1); | ||
| char *ptr = (char *)dst.reserveTruncate((size32_t)fileSize); | ||
| size32_t bytesRead = fileIO->read(0, (size32_t)fileSize, ptr); |
There was a problem hiding this comment.
Changing reserveTruncate() from (fileSize+1) to fileSize removes the null terminator previously appended by this helper, but other callers still assume a terminator is present (e.g. CXRefNode::serializeBranch drops len-1 and will now truncate the last byte). Either restore the prior contract (ensure a terminator without counting it in dst.length()), or update all call sites and the function comment to treat dst as a length-delimited buffer with no terminator.
There was a problem hiding this comment.
Fixed. I left the null terminator in and changed to use the const char * overload of createPTreeFromXMLString. This way it still avoids trying to process the null terminator.
ef1157c to
ccbfb49
Compare
|
Jirabot Action Result: |
Type of change:
Checklist:
Smoketest:
Testing: