Skip to content

Commit

Permalink
Fix null-pointer dereference
Browse files Browse the repository at this point in the history
I had never seen `face_tracker_dlib::set_position` was called without
it's texture for many years. However, I saw `p->tex` was NULL while
developing another code. It would be safe to ensure the pointer is
valid.
  • Loading branch information
norihiro committed Jul 24, 2024
1 parent 66f9591 commit 4ca8d51
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/face-tracker-dlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ void face_tracker_dlib::set_texture(std::shared_ptr<texture_object> &tex)

void face_tracker_dlib::set_position(const rect_s &rect)
{
if (!p->tex)
return;
p->rect.x0 = rect.x0 / p->tex->scale;
p->rect.y0 = rect.y0 / p->tex->scale;
p->rect.x1 = rect.x1 / p->tex->scale;
Expand Down

0 comments on commit 4ca8d51

Please sign in to comment.