Indiscriminate memset into d->buffer and m->buffer previously caused msan to not detect uninitialized reads.
Also fix tests with uninitialized read bugs that are detected by msan after this change.
PiperOrigin-RevId: 451508224
Change-Id: I1f4b080a8ef765c34ba7a0adc2c686419f6e5516