Skip to content

Commit

Permalink
helpers: fix jpeg and webp OOM error (#401)
Browse files Browse the repository at this point in the history
* Update Jpeg.cpp

* Update Webp.cpp
  • Loading branch information
daywalker-dev authored Jul 5, 2024
1 parent 29420dd commit 6e09211
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/helpers/Jpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ cairo_surface_t* JPEG::createSurfaceFromJPEG(const std::filesystem::path& path)
jpeg_read_scanlines(&decompressStruct, &rowRead, 1);
}

cairo_surface_flush(cairoSurface);
cairo_surface_mark_dirty(cairoSurface);
cairo_surface_set_mime_data(cairoSurface, CAIRO_MIME_TYPE_JPEG, (const unsigned char*)imageRawData, fileInfo.st_size, free, imageRawData);
jpeg_finish_decompress(&decompressStruct);
Expand Down
1 change: 1 addition & 0 deletions src/helpers/Webp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ cairo_surface_t* WEBP::createSurfaceFromWEBP(const std::filesystem::path& path)
return nullptr;
}

cairo_surface_flush(cairoSurface);
cairo_surface_mark_dirty(cairoSurface);
cairo_surface_set_mime_data(cairoSurface, CAIRO_MIME_TYPE_PNG, (const unsigned char*)imageRawData, fileInfo.st_size, free, imageRawData);

Expand Down

0 comments on commit 6e09211

Please sign in to comment.