Flipper filled rotten wood with Great Stuff

I discover that one of the bedroom windows has frame and sill that was mostly rotted-away. The flipper simply filled the rotten gap with yellow expanding foam, and painted over it to hide the problem.