[Mesa-dev] [Bug 108636] test_optpass has use after free bug, failing with memory testing tools like address sanitizer

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Nov 2 14:32:17 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=108636

            Bug ID: 108636
           Summary: test_optpass has use after free bug, failing with
                    memory testing tools like address sanitizer
           Product: Mesa
           Version: git
          Hardware: Other
                OS: All
            Status: NEW
          Severity: minor
          Priority: medium
         Component: glsl-compiler
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: hanno at hboeck.de
        QA Contact: intel-3d-bugs at lists.freedesktop.org

Created attachment 142340
  --> https://bugs.freedesktop.org/attachment.cgi?id=142340&action=edit
patch to fix use after free in test_optpass.

When compiling mesa with address sanitizer (-fsanitize=address) and running the
test suite a use after free bug is exposed in test_optpass.cpp.

This is the code:

   ralloc_free(state);
   ralloc_free(shader);

   return state->error;

This is obviously not correct. First state is free'd and then state->error is
used as the return value.

Given this is only a test this is not severe, yet it still should be fixed so
mesa can easily be tested with address sanitizer or other memory safety check
tools.

See attached patch (works on both git and 18.2.4), I'm saving state->error to a
variable and then returning that.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181102/f895cca0/attachment.html>


More information about the mesa-dev mailing list