Just to add that adding the patched files to 1.5.1 and 1.5.8 causes the media gallery to not allow video embedding as it results in an unknown error message most of the time, on occasion it causes a thumbnail generation error.
No patches, and i've just reverted back to the files available in my download area to make it work again but obviously i'm worried about security. My sites are adfree these days and rely on donations, and I just can't justify upgrade costs unless the sites have thousand of users or at least some income
I tried different Facebook and YouTube videos over a few hours trying to figure out what it could be before making the post after I replaced the files back to their original ones and noticed things working again.
I'll be able to attempt to reproduce this shortly.
In the meantime if you get a chance, it might be worth reapplying the patch and testing it with all other add ons disabled (even non Gallery ones) and also with any browser extensions disabled (especially ad or script blockers).
If you can start a conversation with me and include login details for a user account that experiences the problem, and access to the Admin CP and perhaps login details for FTP access too, that'd be great.
I'll see if I can get to the root of the problem for you.
Pleased to report the issue has been identified and fixed, for you.
I'm not totally sure how it happened, and even less sure how it happened on two different XF installs, but a single file (as far as I can tell) was a much older version than it should be (perhaps circa XFMG 1.0.x).
As a precaution I re-uploaded all of the XFMG files for both sites and this seems to have solved the problem.