-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect error message from binary_to_term/2
with safe
#5171
Comments
Not sure but looks like this is expected behavior, please see #binary_to_term-2: 1 > binary_to_term(<<131,100,0,10,97,95,110,101,119,95,97,116,111,109>>, [safe]).
** exception error: bad argument
...
1> a_new_atom.
a_new_atom
2> binary_to_term(<<131,100,0,10,97,95,110,101,119,95,97,116,111,109>>, [safe]).
a_new_atom (C):
|
I agree that failing with a The bug is that the What it should say is that |
Then this sounds like improvement, not a bug. If yes, maybe make sense to change the label. |
If the error message were unclear, like "one of the arguments is bad", clarifying it would be an improvement. But it clearly indicates the wrong information - it says the second argument is bad when in fact the first one is bad. I would call that a bug. But since this does not actually cause incorrect execution, but only makes debugging difficult, maybe you wouldn't call it a bug. It's definitely a small bug, at most. I'm happy to leave classification to the maintainers. |
I consider it a bug. |
…OTP-17591 Correct extended error for binary_to_term/2
Describe the bug
If
binary_to_term/2
is called with thesafe
option and the binary contains a non-existent atom, the error message indicates that thesafe
option itself is invalid.To Reproduce
The
bad argument
error saysargument 2: invalid option in list
. This is not correct;safe
is a valid option.If we then call the function without
safe
, it will allocate the atoma_new_atom
.Now that the atom has been allocated, the
safe
option works just fine.Expected behavior
The error message should indicate that the binary is unsafe.
Affected versions
This bug is present on
master
as of the latest commit, b2f0302 on 2021-07-23.The text was updated successfully, but these errors were encountered: