| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/accessibility/ax_tree.h" | 5 #include "ui/accessibility/ax_tree.h" |
| 6 | 6 |
| 7 class EmptyAXTreeDelegate : public ui::AXTreeDelegate { | 7 class EmptyAXTreeDelegate : public ui::AXTreeDelegate { |
| 8 public: | 8 public: |
| 9 EmptyAXTreeDelegate() {} | 9 EmptyAXTreeDelegate() {} |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 const std::vector<Change>& changes) override {} | 24 const std::vector<Change>& changes) override {} |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 // Entry point for LibFuzzer. | 27 // Entry point for LibFuzzer. |
| 28 extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { | 28 extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { |
| 29 ui::AXTreeUpdate initial_state; | 29 ui::AXTreeUpdate initial_state; |
| 30 size_t i = 0; | 30 size_t i = 0; |
| 31 while (i < size) { | 31 while (i < size) { |
| 32 ui::AXNodeData node; | 32 ui::AXNodeData node; |
| 33 node.id = data[i++]; | 33 node.id = data[i++]; |
| 34 node.state = 0; | |
| 35 if (i < size) { | 34 if (i < size) { |
| 36 size_t child_count = data[i++]; | 35 size_t child_count = data[i++]; |
| 37 for (size_t j = 0; j < child_count && i < size; j++) | 36 for (size_t j = 0; j < child_count && i < size; j++) |
| 38 node.child_ids.push_back(data[i++]); | 37 node.child_ids.push_back(data[i++]); |
| 39 } | 38 } |
| 40 initial_state.nodes.push_back(node); | 39 initial_state.nodes.push_back(node); |
| 41 } | 40 } |
| 42 | 41 |
| 43 // Run with --v=1 to aid in debugging a specific crash. | 42 // Run with --v=1 to aid in debugging a specific crash. |
| 44 VLOG(1) << "Input accessibility tree:\n" << initial_state.ToString(); | 43 VLOG(1) << "Input accessibility tree:\n" << initial_state.ToString(); |
| 45 | 44 |
| 46 EmptyAXTreeDelegate delegate; | 45 EmptyAXTreeDelegate delegate; |
| 47 ui::AXTree tree; | 46 ui::AXTree tree; |
| 48 tree.SetDelegate(&delegate); | 47 tree.SetDelegate(&delegate); |
| 49 tree.Unserialize(initial_state); | 48 tree.Unserialize(initial_state); |
| 50 | 49 |
| 51 return 0; | 50 return 0; |
| 52 } | 51 } |
| OLD | NEW |