There are multiple reasons what could have caused the issue in the first place. The known issues have been addressed. One of the fairly recent ones that was fixed was
https://github.com/apache/bookkeeper/pull/4607, which has been included since Pulsar 3.0.13, 3.3.8, 4.0.6, and 4.1.0. Please make sure to use most recent supported version of Pulsar. Currently it's 3.0.15, 4.0.8, and 4.1.2, which
are supported.
Fixing data corruption is specific to the situation and what needs to be done depends on the situation.