This bug was reported in
(33692.1)The game was
(5994129)Marlon Talosa
(1145654) had seven fouls. The playback shows the 6th foul at 0:36 remaining in the 4Q and the 7th at 0:05. He remained in the game for the final 5 seconds as well. There were plenty of players available for substitution.
At the time of the foul at 0:36 there was mass substitution for both teams. Maybe Talosa snuck back on the court. And perhaps the game engine checks for 6 fouls exactly rather than greater than or equal to 6 for a foul out.