Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
-
shouldBeFour =eval("return " + ['1','+','3'].join('')) should work. Though I haven't tried it since I'm on the phone.
-
@JoshBent He never said that it was uncontrolled input. If the data is save eval is completely fine. If it isn't its a great learning opportunity.
-
void func(const char *str) {
if (!strcmp(str, "[\"1\", \"+\", \"3\"]"))
printf("4");
} -
@Godisalie "hey, here's my asshole, I know your dick is safe, otherwise the STD will be a great learning opportunity!"
-
@Demolishun Of course. Whoever is willing to let other peoples input run on his site because a stranger on the internet hacked away a line he shouldn't be in charge of anything thats worth attacking and getting his ass kicked on a minor project might be helpful. Otherwise I expect he's able to reflect on what repercussions using eval in his code could have and make an informed decision.
-
@highlight Ha ! So close :) Hello lazy friend :)
Does bot reacts on edits ?
Where do I report a bug ? -
@Godisalie If I remember right, there are other forms of eval that will only evaluate math expressions and values. I have used that to safely evaluate user inputs in Python.
https://stackoverflow.com/questions...
This would be much safer. -
Skayo88595y<@NoToJavaScript>
The best way to report a bug is to just @-mention me :)
What's wrong?
He won't recognize your edits btw.
I could implement it, but it makes the whole thing much more complicated...
how do you code and evaluate this, should output 4
["1", "+", "3"]
question