You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
staticconstFcMatcher_FcMatchers [] = {
{ FC_INVALID_OBJECT, NULL, NULL, -1, -1 },
#include"fcobjs.h"
};
/* ... */// Find the matcher for given priorityconstFcMatcher*matcher=NULL;
for (matcher=&_FcMatchers[0]; matcher->weak!=priority&&matcher->strong!=priority; matcher++);
assert(matcher); // The assertion will do nothing as the loop will always set a nice value.
With a bad priority the loop might just go on indefinitely since it doesn't check for an end. This generally won't happen unless someone made the priorities inconsistent with fcobj.h.
An extra check likely(matcher - _FcMatchers <= FC_MAX_BASE_OBJECT) can be added to catch this problem for debug builds.
The text was updated successfully, but these errors were encountered:
Artoria2e5
changed the title
FcFontSetMatchInternal can go out of bounds for a bad priority
FcFontSetMatchInternal can go out of bounds for a bad priority if someone breaks fcobj/pri_max
Feb 22, 2018
Artoria2e5
changed the title
FcFontSetMatchInternal can go out of bounds for a bad priority if someone breaks fcobj/pri_max
FcFontSetMatchInternal can go out of bounds for a bad priority if PRI_MAX gets broken
Feb 22, 2018
The assumption is of course that the _FcMatchers and _FcMatcherPriority match together. As long as they do, no external input can break it. But a debug assert to catch mistakes during development would be nice.
In the current version:
With a bad priority the loop might just go on indefinitely since it doesn't check for an end. This generally won't happen unless someone made the priorities inconsistent with
fcobj.h
.An extra check
likely(matcher - _FcMatchers <= FC_MAX_BASE_OBJECT)
can be added to catch this problem for debug builds.The text was updated successfully, but these errors were encountered: