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

via libc-commits libc-commits at lists.llvm.org
Sat Sep 21 20:08:17 PDT 2024


Author: Petr Hosek
Date: 2024-09-21T20:08:13-07:00
New Revision: eaedbbc30ded7965f37cfa90149daf308656c299

URL: https://github.com/llvm/llvm-project/commit/eaedbbc30ded7965f37cfa90149daf308656c299
DIFF: https://github.com/llvm/llvm-project/commit/eaedbbc30ded7965f37cfa90149daf308656c299.diff

LOG: [libc] Use `yaml.safe_load` rather than `yaml.load` (#109557)

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

Added: 
    

Modified: 
    libc/newhdrgen/yaml_functions_sorted.py

Removed: 
    


################################################################################
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"])


        


More information about the libc-commits mailing list