[libc-commits] [libc] [libc] Use `yaml.safe_load` rather than `yaml.load` (PR #109557)

via libc-commits libc-commits at lists.llvm.org
Sat Sep 21 19:16:46 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

<details>
<summary>Changes</summary>

`yaml.load` is considered unsafe, use `yaml.safe_load`.

---
Full diff: https://github.com/llvm/llvm-project/pull/109557.diff


1 Files Affected:

- (modified) libc/newhdrgen/yaml_functions_sorted.py (+1-1) 


``````````diff
diff --git a/libc/newhdrgen/yaml_functions_sorted.py b/libc/newhdrgen/yaml_functions_sorted.py
index db19edf7481de2..b960ecaf973f52 100644
--- a/libc/newhdrgen/yaml_functions_sorted.py
+++ b/libc/newhdrgen/yaml_functions_sorted.py
@@ -6,7 +6,7 @@
 
 def sort_yaml_functions(yaml_file):
     with open(yaml_file, "r") as f:
-        yaml_data = yaml.load(f, Loader=yaml.FullLoader)
+        yaml_data = yaml.safe_load(f)
 
     if "functions" in yaml_data:
         yaml_data["functions"].sort(key=lambda x: x["name"])

``````````

</details>


https://github.com/llvm/llvm-project/pull/109557


More information about the libc-commits mailing list