Fix types in trace - #9119
Merged
Merged
Conversation
hvlad
approved these changes
Aug 7, 2026
hvlad
left a comment
Member
There was a problem hiding this comment.
I have no idea why MetaId appeared here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
MetaId(USHORT), a type not intended forholding counts, to iterate up to
m_info.pin_count(typesize_t),risking narrowing and a potential infinite loop.
MessageSetusedintfor message codes that are always within asmall fixed range, wider than necessary.
Fix
FB_SIZE_Tto match the type ofm_info.pin_countit's compared against, avoiding narrowing.MessageSetfields toUSHORT.Notes
pin_count's type isn't an option sincePerformanceInfoisa public struct used outside this file — that would be an API change.
Casting
pin_countat the comparison would just hide the mismatchrather than fix it:
iis used as an array index intom_tableCounters, not as aMetaId, soMetaIdwas the wrong typehere regardless of
pin_count's type. Widening the loop variable toFB_SIZE_Tfixes the actual type mismatch and removes the risk ofoverflow/infinite loop if
pin_countever grows beyondUSHORTrange.MessageSetfields were changed toUSHORT. All current usages(
MAIN_USAGE,EXAMPLES) are initialized with message codes in range3..42, e.g.
MAIN_USAGE{{3, 21}, {41}},EXAMPLES{{22, 27}, {42}}—well within
USHORT(0..65535). If new codes are added in the future,make sure they still fit into
USHORT.