Kari Pikkarainen ec2101a1a1 python: raise instead of crashing on strings that can't be encoded as UTF-8
getUnicodeString passed the result of PyUnicode_AsUTF8String to
PyBytes_Check without a NULL check. For a str with a lone surrogate
(for example '\udcff') the encoder fails and returns NULL, so passing such
a string to any std::string argument (putText, getTextSize, ...) crashed
the interpreter. It now returns false with the UnicodeEncodeError set,
which the converters already report.

Prepared with AI assistance (Claude Code); I reviewed the change and the verification results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 06:59:07 -08:00
2018-10-11 17:57:51 +00:00
2026-11-18 19:15:21 +03:00
2025-08-07 10:35:20 +03:00

OpenCV: Open Source Computer Vision Library

Resources

Contributing

Please read the contribution guidelines before starting work on a pull request.

Summary of the guidelines:

  • One pull request per issue;
  • Choose the right base branch: all new work goes to 5.x, while 4.x accepts only bug fixes and other minor fixes;
  • Include tests and documentation;
  • Clean up "oops" commits before submitting;
  • Follow the coding style guide.

Additional Resources

Description
Languages
C++ 87.7%
C 3.1%
Python 2.9%
CMake 2%
Java 1.5%
Other 2.6%