HackMD
  • Beta
    Beta  Get a sneak peek of HackMD’s new design
    Turn on the feature preview and give us feedback.
    Go → Got it
    • Beta  Get a sneak peek of HackMD’s new design
      Beta  Get a sneak peek of HackMD’s new design
      Turn on the feature preview and give us feedback.
      Go → Got it
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Please check the box to agree to the Community Guidelines.
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive Export to Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive Import from Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
    Menu Sharing Help
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Export to Google Drive Gist
    Import
    Dropbox Google Drive Import from Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    Write
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Please check the box to agree to the Community Guidelines.
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Slic3r libslic3r PerimeterGenerator Memory Leakage Vulnerability ### CVE Number CVE-2021-44961 ### Summary A memory leakage flaw exists in the class PerimeterGenerator of Slic3r libslic3r 1.3.0 and Master Commit b1a5500. Specially crafted stl files can exhaust available memory. An attacker can provide malicious files to trigger this vulnerability. ### Tested Versions Slic3r libslic3r 1.3.0 Slic3r libslic3r Master Commit b1a5500 ### Product URLs https://slic3r.org/ ### Details When reading in an `.stl` file with the `--export-gcode` argument, `class PerimeterGenerator` is invoked. The class has some pointers to objects, but it does not provide a destructor and instead uses the default destructor. However, the default destructor only destroys the pointer, but not what the pointer was pointing to. Therefore, the allocated memories are not properly released upon the destruction of `class PerimeterGenerator`, leading to potential memory exhaustion. ```cpp=38 class PerimeterGenerator { public: // Inputs: const SurfaceCollection* slices; const ExPolygonCollection* lower_slices; double layer_height; int layer_id; Flow perimeter_flow; Flow ext_perimeter_flow; Flow overhang_flow; Flow solid_infill_flow; PrintRegionConfig* config; PrintObjectConfig* object_config; PrintConfig* print_config; // Outputs: ExtrusionEntityCollection* loops; ExtrusionEntityCollection* gap_fill; SurfaceCollection* fill_surfaces; PerimeterGenerator( // Input: const SurfaceCollection* slices, double layer_height, Flow flow, PrintRegionConfig* config, PrintObjectConfig* object_config, PrintConfig* print_config, // Output: // Loops with the external thin walls ExtrusionEntityCollection* loops, // Gaps without the thin walls ExtrusionEntityCollection* gap_fill, // Infills without the gap fills SurfaceCollection* fill_surfaces) : slices(slices), lower_slices(NULL), layer_height(layer_height), layer_id(-1), perimeter_flow(flow), ext_perimeter_flow(flow), overhang_flow(flow), solid_infill_flow(flow), config(config), object_config(object_config), print_config(print_config), loops(loops), gap_fill(gap_fill), fill_surfaces(fill_surfaces), _ext_mm3_per_mm(-1), _mm3_per_mm(-1), _mm3_per_mm_overhang(-1) {}; void process(); private: double _ext_mm3_per_mm; double _mm3_per_mm; double _mm3_per_mm_overhang; Polygons _lower_slices_p; ExtrusionEntityCollection _traverse_loops(const PerimeterGeneratorLoops &loops, ThickPolylines &thin_walls) const; ExtrusionEntityCollection _variable_width (const ThickPolylines &polylines, ExtrusionRole role, Flow flow) const; }; } ``` ### Crash Information ```sh Direct leak of 19456 byte(s) in 304 object(s) allocated from: #0 0x55dca2 in operator new(unsigned long) (/home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/build/slic3r+0x55dca2) #1 0xe9ef4d in Slic3r::ExtrusionPath::clone() const /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/src/../xs/src/libslic3r/ExtrusionEntity.hpp:77:43 #2 0x69c402 in Slic3r::ExtrusionEntityCollection::append(Slic3r::ExtrusionEntity const&) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:94:37 #3 0x6985fa in Slic3r::ExtrusionEntityCollection::append(std::vector<Slic3r::ExtrusionEntity*, std::allocator<Slic3r::ExtrusionEntity*> > const&) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:101:15 #4 0x697dc8 in Slic3r::ExtrusionEntityCollection::ExtrusionEntityCollection(Slic3r::ExtrusionEntityCollection const&) Direct leak of 19456 byte(s) in 304 object(s) allocated from: #0 0x55dca2 in operator new(unsigned long) (/home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/build/slic3r+0x55dca2) #1 0xe9ef4d in Slic3r::ExtrusionPath::clone() const /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/src/../xs/src/libslic3r/ExtrusionEntity.hpp:77:43 #2 0x69c402 in Slic3r::ExtrusionEntityCollection::append(Slic3r::ExtrusionEntity const&) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:94:37 #3 0x6985fa in Slic3r::ExtrusionEntityCollection::append(std::vector<Slic3r::ExtrusionEntity*, std::allocator<Slic3r::ExtrusionEntity*> > const&) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:101:15 #4 0x697dc8 in Slic3r::ExtrusionEntityCollection::ExtrusionEntityCollection(Slic3r::ExtrusionEntityCollection const&) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:11:11 #5 0x69ad9c in Slic3r::ExtrusionEntityCollection::clone() const /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:61:43 #6 0x69c402 in Slic3r::ExtrusionEntityCollection::append(Slic3r::ExtrusionEntity const&) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:94:37 #7 0x1030a22 in Slic3r::PerimeterGenerator::process() /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/PerimeterGenerator.cpp:274:30 #8 0xfe5efd in Slic3r::LayerRegion::make_perimeters(Slic3r::SurfaceCollection const&, Slic3r::SurfaceCollection*) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/LayerRegion.cpp:70:7 #9 0xfd6d81 in Slic3r::Layer::make_perimeters() /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/Layer.cpp:201:24 #10 0xaebb2b in boost::_mfi::mf0<void, Slic3r::Layer>::operator()(Slic3r::Layer*) const /usr/include/boost/bind/mem_fn_template.hpp:49:29 #11 0xaeb921 in void boost::_bi::list1<boost::arg<1> >::operator()<boost::_mfi::mf0<void, Slic3r::Layer>, boost::_bi::list1<Slic3r::Layer* const&> >(boost::_bi::type<void>, boost::_mfi::mf0<void, Slic3r::Layer>&, boost::_bi::list1<Slic3r::Layer* const&>&, int) /usr/include/boost/bind/bind.hpp:253:9 #12 0xaeb796 in void boost::_bi::bind_t<void, boost::_mfi::mf0<void, Slic3r::Layer>, boost::_bi::list1<boost::arg<1> > >::operator()<Slic3r::Layer*>(Slic3r::Layer*&&) /usr/include/boost/bind/bind.hpp:905:16 #13 0xaeaed4 in boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf0<void, Slic3r::Layer>, boost::_bi::list1<boost::arg<1> > >, void, Slic3r::Layer*>::invoke(boost::detail::function::function_buffer&, Slic3r::Layer*) /usr/include/boost/function/function_template.hpp:159:11 #14 0xae54fe in boost::function1<void, Slic3r::Layer*>::operator()(Slic3r::Layer*) const /usr/include/boost/function/function_template.hpp:772:14 #15 0xaddf94 in void Slic3r::_parallelize_do<Slic3r::Layer*>(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/src/../xs/src/libslic3r/Fill/../libslic3r.h:119:9 #16 0xae7383 in void boost::_bi::list3<boost::_bi::value<std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*>, boost::_bi::value<boost::mutex*>, boost::_bi::value<boost::function<void (Slic3r::Layer*)> > >::operator()<void (*)(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>), boost::_bi::list0>(boost::_bi::type<void>, void (*&)(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>), boost::_bi::list0&, int) /usr/include/boost/bind/bind.hpp:392:9 #17 0xae70d6 in boost::_bi::bind_t<void, void (*)(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>), boost::_bi::list3<boost::_bi::value<std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*>, boost::_bi::value<boost::mutex*>, boost::_bi::value<boost::function<void (Slic3r::Layer*)> > > >::operator()() /usr/include/boost/bind/bind.hpp:893:16 #18 0xae69be in boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>), boost::_bi::list3<boost::_bi::value<std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*>, boost::_bi::value<boost::mutex*>, boost::_bi::value<boost::function<void (Slic3r::Layer*)> > > > >::run() /usr/include/boost/thread/detail/thread.hpp:116:17 #19 0x1c8b334 in thread_proxy (/home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/build/slic3r+0x1c8b334)/home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:11:11 #5 0x69ad9c in Slic3r::ExtrusionEntityCollection::clone() const /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:61:43 #6 0x69c402 in Slic3r::ExtrusionEntityCollection::append(Slic3r::ExtrusionEntity const&) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/ExtrusionEntityCollection.cpp:94:37 #7 0x1030a22 in Slic3r::PerimeterGenerator::process() /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/PerimeterGenerator.cpp:274:30 #8 0xfe5efd in Slic3r::LayerRegion::make_perimeters(Slic3r::SurfaceCollection const&, Slic3r::SurfaceCollection*) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/LayerRegion.cpp:70:7 #9 0xfd6d81 in Slic3r::Layer::make_perimeters() /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/xs/src/libslic3r/Layer.cpp:201:24 #10 0xaebb2b in boost::_mfi::mf0<void, Slic3r::Layer>::operator()(Slic3r::Layer*) const /usr/include/boost/bind/mem_fn_template.hpp:49:29 #11 0xaeb921 in void boost::_bi::list1<boost::arg<1> >::operator()<boost::_mfi::mf0<void, Slic3r::Layer>, boost::_bi::list1<Slic3r::Layer* const&> >(boost::_bi::type<void>, boost::_mfi::mf0<void, Slic3r::Layer>&, boost::_bi::list1<Slic3r::Layer* const&>&, int) /usr/include/boost/bind/bind.hpp:253:9 #12 0xaeb796 in void boost::_bi::bind_t<void, boost::_mfi::mf0<void, Slic3r::Layer>, boost::_bi::list1<boost::arg<1> > >::operator()<Slic3r::Layer*>(Slic3r::Layer*&&) /usr/include/boost/bind/bind.hpp:905:16 #13 0xaeaed4 in boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf0<void, Slic3r::Layer>, boost::_bi::list1<boost::arg<1> > >, void, Slic3r::Layer*>::invoke(boost::detail::function::function_buffer&, Slic3r::Layer*) /usr/include/boost/function/function_template.hpp:159:11 #14 0xae54fe in boost::function1<void, Slic3r::Layer*>::operator()(Slic3r::Layer*) const /usr/include/boost/function/function_template.hpp:772:14 #15 0xaddf94 in void Slic3r::_parallelize_do<Slic3r::Layer*>(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>) /home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/src/../xs/src/libslic3r/Fill/../libslic3r.h:119:9 #16 0xae7383 in void boost::_bi::list3<boost::_bi::value<std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*>, boost::_bi::value<boost::mutex*>, boost::_bi::value<boost::function<void (Slic3r::Layer*)> > >::operator()<void (*)(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>), boost::_bi::list0>(boost::_bi::type<void>, void (*&)(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>), boost::_bi::list0&, int) /usr/include/boost/bind/bind.hpp:392:9 #17 0xae70d6 in boost::_bi::bind_t<void, void (*)(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>), boost::_bi::list3<boost::_bi::value<std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*>, boost::_bi::value<boost::mutex*>, boost::_bi::value<boost::function<void (Slic3r::Layer*)> > > >::operator()() /usr/include/boost/bind/bind.hpp:893:16 #18 0xae69be in boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*, boost::mutex*, boost::function<void (Slic3r::Layer*)>), boost::_bi::list3<boost::_bi::value<std::queue<Slic3r::Layer*, std::deque<Slic3r::Layer*, std::allocator<Slic3r::Layer*> > >*>, boost::_bi::value<boost::mutex*>, boost::_bi::value<boost::function<void (Slic3r::Layer*)> > > > >::run() /usr/include/boost/thread/detail/thread.hpp:116:17 #19 0x1c8b334 in thread_proxy (/home/bug/LabSpace/ins_FuzzerRun/Slic3rFuzzer/build/slic3r+0x1c8b334) ``` ### Timeline 2021-11-19 - Vendor Disclosure 2022-01-16 - Public Release

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully