Skip to content

[libde265] Fix potential data race in image.cc #473

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

Merged
merged 1 commit into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions libde265/image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "decctx.h"
#include "en265.h"

#inclue <atomic>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo


#include <stdlib.h>
#include <string.h>
#include <assert.h>
Expand Down Expand Up @@ -187,8 +189,6 @@ void de265_image::set_image_plane(int cIdx, uint8_t* mem, int stride, void *user
}


uint32_t de265_image::s_next_image_ID = 0;

de265_image::de265_image()
{
ID = -1;
Expand Down Expand Up @@ -249,6 +249,7 @@ de265_error de265_image::alloc_image(int w,int h, enum de265_chroma c,
allocated to the requested size. Without the release, the old image-data
will not be freed. */

static std::atomic<uint32_t> s_next_image_ID(0);
ID = s_next_image_ID++;
removed_at_picture_id = std::numeric_limits<int32_t>::max();

Expand Down
1 change: 0 additions & 1 deletion libde265/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ struct de265_image {

private:
uint32_t ID;
static uint32_t s_next_image_ID;

uint8_t* pixels[3];
uint8_t bpp_shift[3]; // 0 for 8 bit, 1 for 16 bit
Expand Down
Loading