It's not clear to me yet if there already is a patch. The link into the oss-security archive hopefully has an answer soon.
Bernhard Rosenkraenzer (https://github.com/berolinux) has shared a candidate patch (https://github.com/OpenMandrivaAssociation/giflib/blob/master/giflib-5.2.2-cve-2025-31344.patch) a moment ago and (while I do not have a reproducer GIF file to test it with) and the patch looks good to me: my vote for application in Gentoo.