mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 16:27:54 -06:00
slic3r: address sanitizer cleanup in ImGuiWrapper::load_svg
ImGuiWrapper::load_svg previously could load an image that was not of the aspect ratio specified by the target_width and target_height, and as a result, could create an output vector that was smaller (or differently shaped!) than the target_width and target_height. GCC's Address Sanitizer flagged this because init_font was reading over the end of the allocated buffer, but this also meant that images with incorrect aspect ratios might get rendered to the font canvas incorrectly. To solve this, we pass the generated width and height out from load_svg, and use it when copying images later.
This commit is contained in:
parent
64173b3fa3
commit
ab64ae8c63
2 changed files with 17 additions and 11 deletions
|
@ -223,7 +223,7 @@ private:
|
|||
void render_draw_data(ImDrawData *draw_data);
|
||||
bool display_initialized() const;
|
||||
void destroy_font();
|
||||
std::vector<unsigned char> load_svg(const std::string& bitmap_name, unsigned target_width, unsigned target_height);
|
||||
std::vector<unsigned char> load_svg(const std::string& bitmap_name, unsigned target_width, unsigned target_height, unsigned *outwidth, unsigned *outheight);
|
||||
|
||||
static const char* clipboard_get(void* user_data);
|
||||
static void clipboard_set(void* user_data, const char* text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue