mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Raise ValueError if null character exists for eval argument
This commit is contained in:
1 parent
56f08a1417
commit
bb8526ac28
1 file changed
+5
@@ -259,6 +259,11 @@ mod builtins {
|
||||
Either::A(ref a) => a.as_str().as_bytes(),
|
||||
Either::B(ref b) => b.as_bytes(),
|
||||
};
|
||||
for x in source {
|
||||
if *x == 0 {
|
||||
return Err(vm.new_value_error("source code string cannot contain null bytes".to_owned()));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Either::A(vm.ctx.new_str(std::str::from_utf8(source).unwrap())))
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user