I apologize if this has already been asked; I can't find this exact question.
Suppose author X writes a paper, and in this paper, they prove a result that is a very small part of their paper. However, the result has a mistake. Based on personal judgement, it appears the mistake is an innocent mistake that does not disrupt the intellectual flow of the paper. i.e. it is very reasonable to believe the author X had the ability themselves to get the proof right. In fact, it may have been simply a typo. Nonetheless, it is unarguably incorrect.
Author Y comes along and builds other results off of the (corrected) ideas by author X. Author Y wants to (for good reason) cite author X, as their results would not have been obtained without author X.
What is the correct way to do this in a paper? The way I see it, there are 2 possible actions for author Y:
1) Pretend like author X didn't make a mistake at all and give them full authority on their theorem. 2) Say something like ... "the results are based off the ideas by author X" but don't give as much of a "these are author X's results" flavor. Author Y then after mentioning author X, proves the theorem themselves.
Action 2) seems to be the most reasonable in the sense that it is intellectual honest and doesn't shame author X for no reason. However, is it considered plagiarism to be somewhat vague about what author X did?
EDIT: I realize another option is to allow author X to correct their mistake and then do action 1. But with how slowly paper publishing occurs, this seems unjustly detrimental to author Y so I don't consider it a real option.