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@lists.freedesktop.org
          Reporter: ha...@hboeck.de
        QA Contact: intel-3d-b...@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.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to