Either c32rtomb() meets an invalid state, or c16rtomb() meets a wrong low surrogate.
Correct the program to use a correct state, and check the converting character.
JrEdcMbwcEilseq12