Skip to content

Commit

Permalink
Do not warn about usages of binary_to_term
Browse files Browse the repository at this point in the history
Summary: Detection of unsafe usages for `binary_to_term` is opinionated. Temporarily disable it, while working on making it configurable.

Differential Revision: D56922819

fbshipit-source-id: 2f3838d475bcb5416bf4d5895bbd578693633e70
  • Loading branch information
robertoaloi authored and facebook-github-bot committed May 3, 2024
1 parent 99ebfe9 commit d5627c5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crates/ide/src/diagnostics/atoms_exhaustion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ fn atoms_exhaustion(diagnostics: &mut Vec<Diagnostic>, sema: &Semantic, file_id:
FunctionMatch::mfa("erlang", "binary_to_atom", 1),
FunctionMatch::mfa("erlang", "binary_to_atom", 2),
FunctionMatch::mfa("erlang", "list_to_atom", 1),
FunctionMatch::mfa("erlang", "binary_to_term", 1),
FunctionMatch::mfa("erlang", "binary_to_term", 2),
// T187850479: Make it configurable
// FunctionMatch::mfa("erlang", "binary_to_term", 1),
// FunctionMatch::mfa("erlang", "binary_to_term", 2),
]
.into_iter()
// @fb-only: .chain(diagnostics::meta_only::atoms_exhaustion_matches().into_iter())
Expand Down Expand Up @@ -175,10 +176,8 @@ mod tests {
main() ->
Foo = term_to_binary(foo),
binary_to_term(Foo),
%% ^^^^^^^^^^^^^^^^^^^ 💡 error: Risk of atoms exhaustion.
Bar = term_to_binary(bar),
erlang:binary_to_term(Bar).
%% ^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: Risk of atoms exhaustion.
//- /opt/lib/stdlib-3.17/src/erlang.erl otp_app:/opt/lib/stdlib-3.17
-module(erlang).
Expand Down Expand Up @@ -222,10 +221,8 @@ mod tests {
main() ->
Foo = term_to_binary(foo),
binary_to_term(Foo, []),
%% ^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: Risk of atoms exhaustion.
Bar = term_to_binary(bar),
erlang:binary_to_term(Bar, []).
%% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: Risk of atoms exhaustion.
//- /opt/lib/stdlib-3.17/src/erlang.erl otp_app:/opt/lib/stdlib-3.17
-module(erlang).
Expand Down

0 comments on commit d5627c5

Please sign in to comment.