Skip to content

OSS-Fuzz: Create new fuzzer/corpus/dict targets xml processing - #1279

Open
arthurscchan wants to merge 2 commits into
BehaviorTree:masterfrom
arthurscchan:behaviortreecpp-xml-roundtrip
Open

arthurscchan wants to merge 2 commits into
BehaviorTree:masterfrom
arthurscchan:behaviortreecpp-xml-roundtrip

Conversation

@arthurscchan

Copy link
Copy Markdown
Contributor

This PR creates a new OSS-Fuzz fuzzer with corpus/dict targets xml processing, together with google/oss-fuzz#16436 to enable a new fuzzer for proejct BehaviorTree.CPP.

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>

@facontidavide facontidavide left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @arthurscchan. As it stands this target can't find the bugs it's aimed at:

  1. There's no round-trip check. Modes 1–2 export, re-import and export again, but never compare the results. A logic divergence (a lost name, a dropped port) goes unnoticed. For example #1262 (SubTree name dropped by WriteTreeToXML, fixed in #1268) would not have been found.
  2. A failed re-import is swallowed. If factory2.registerBehaviorTreeFromText(exported) or createTree throws, that means BT.CPP can't read its own output, which is a real bug. The outer catch(const std::exception&) hides it. Exceptions are fine for the generated input, but not for the re-import.
  3. Mode 0 duplicates bt_fuzzer (raw bytes into the parser).
  4. writeTreeXSD(factory) and writeTreeNodesModelXML act on a fixed factory, so the result doesn't depend on the input. It only slows each run.

Suggested shape: generate a valid tree, exported1 = WriteTreeToXML(tree, false, false), re-import it in a fresh factory outside the try/catch (or abort() in its catch), exported2 = WriteTreeToXML(tree2, false, false), then if(exported1 != exported2) abort();. Drop mode 0 and the XSD/model writers. Happy to merge that version.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants