Skip to content

sc-158713: Fix buffer overflow, memory leaks, error handling - #6

Open
ptamb3 wants to merge 1 commit into
openalpr:masterfrom
ptamb3:sc-158713
Open

ptamb3 wants to merge 1 commit into
openalpr:masterfrom
ptamb3:sc-158713

Conversation

@ptamb3

@ptamb3 ptamb3 commented May 7, 2026

Copy link
Copy Markdown

Summary

  • Replace strcpy with g_strlcpy for license plate strings (buffer overflow fix)
  • Add NULL check after DsOpenalprCtx_Init to prevent NULL deref
  • Free cvmat and cached_results on error path (memory leak fix)
  • Replace assert() with proper error handling and GST_WARNING logging
  • Update deprecated CV_RGBA2BGR to cv::COLOR_RGBA2BGR
  • Add -Wall -fstack-protector-strong to Makefile CFLAGS

Test plan

  • Build on Jetson device with DeepStream SDK
  • Verify license plate recognition still works end-to-end
  • Test error path when DsOpenalprCtx_Init fails
  • Verify no memory leaks with valgrind under repeated init/deinit

Shortcut: https://app.shortcut.com/rekor/story/158713

🤖 Generated with Claude Code

- Replace strcpy with g_strlcpy for license plate strings (buffer overflow)
- Add NULL check after DsOpenalprCtx_Init
- Free cvmat and cached_results on error path (memory leaks)
- Replace assert with proper error handling and logging
- Update deprecated CV_RGBA2BGR to cv::COLOR_RGBA2BGR
- Add -Wall and -fstack-protector-strong to Makefile CFLAGS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant