LSP: textDocument/codeAction CodeActionParams with wrong Range

I don’t know if this issue is connected to this other line end issue, but it’s also cropping up with the Rust Analyzer language server and causing a panic/server crash. Here’s a report from a user (which I easily replicated):

As you can see from the logs in the bug report, it’s the same textDocument/codeAction out of bounds error. Interestingly, the user report (and my testing) also show the same “out of bounds” error for textDocument/completion CompletionParams immediately afterwards (which is what made me think of the other bug report linked above).