boostorg / wave

Boost.org wave module
http://boost.org/libs/wave
21 stars 49 forks source link

Fix UB in memmove #185

Closed AmesingFlank closed 1 year ago

AmesingFlank commented 1 year ago

boost::wave sometimes calls memmove with a nullptr destination and a 0 byte length. This is undefined behavior. This diff adds a check so that memmove is not called if the length is 0

jefftrull commented 1 year ago

Thanks! Do you have a testcase by any chance? Then we could add it to the regression tests.

Also this fixes bug #182 :)

AmesingFlank commented 1 year ago

Thanks! Do you have a testcase by any chance? Then we could add it to the regression tests.

Also this fixes bug #182 :)

I don't have a repro case that I can post here, unfortunately. Can we use the code mentioned in #182 as the regression test?

jefftrull commented 1 year ago

It will require some reduction, I think, but hopefully so.

jefftrull commented 1 year ago

I note with interest your employer :) Glad to know Wave is useful to them.

jefftrull commented 1 year ago

Thanks for your contribution, which will be in Boost 1.82 (releasing soon).