[FFmpeg-devel] [PATCH v2] gdigrab: Allow capturing a window by its handle

Rémi Denis-Courmont remi at remlab.net
Thu Dec 14 12:52:48 EET 2023



Le 13 décembre 2023 12:03:55 GMT+02:00, Nicolas George <george at nsup.org> a écrit :
>Rémi Denis-Courmont (12023-12-12):
>> ...and test for overflow errors in errno.m (which shall have been
>> zeroed beforehand). AFAIK, you need to do both if you want strict
>> error detection.
>
>Or we can consider that 30064771114 is just another valid way if writing
>42 = 042 = 0x2a. It would be better to check, but it is less critical
>than checking for garbage at the and, which itself is less critical than
>checking that the number is entirely absent.

That's completely arbitrary, TBH. Both cases are syntax errors, and there are no particular reasons to tolerate one but not the other. And even if it constitued a sensible distinction, that's simply not how strtoul() handles overflow: it returns ULONG_MAX, not a wrapped-around value.

In this case, both error cases are strong signs of a typing error or corruption.


More information about the ffmpeg-devel mailing list