bufbuild / buf

The best way of working with Protocol Buffers.
https://buf.build
Apache License 2.0
8.49k stars 247 forks source link

Fix append calls that should have copied the slice #3072

Closed oliversun9 closed 3 weeks ago

oliversun9 commented 3 weeks ago

There are usages of append where the result is not assigned back to the variable. After going through them, most of do not break. In fact, it only breaks things when one slice is stored as a variable or a struct's field, and a prefix of this slice is appended to.

This PR fixes problematic appends in populateMessage, which breaks in certain cases (see the test case added).

It also fixes the append in WalkFileInfos.