Skip to content
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

Dangerous, liberal use of eval() #13848

Open
3 tasks done
umarbutler opened this issue Sep 9, 2024 · 0 comments
Open
3 tasks done

Dangerous, liberal use of eval() #13848

umarbutler opened this issue Sep 9, 2024 · 0 comments
Assignees

Comments

@umarbutler
Copy link

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

I would like to flag that there are a number of scripts in your codebase that make use of eval() in ways that are unnecessary, overly liberal and possibly dangerous. In ppocr/postprocess/__init__.py, for example, eval() is used where a dictionary could easily perform the same functionality. In ppocr/data/imaug/__init__.py, the pattern from [script] import * is used 10 times and then eval() is used, which could easily have serious side-effects.

I would recommend refactoring the codebase to cease using eval().

For additional information on why eval() is dangerous, see https://lucumr.pocoo.org/2011/2/1/exec-in-python/ and https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html.

🏃‍♂️ Environment (运行环境)

N/A

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants