| 129 | } |
| 130 | |
| 131 | internal bool TryGetTypeMetaByHeader(ulong header, out TypeMeta typeMeta) |
| 132 | { |
| 133 | // UInt64Map reserves ulong.MaxValue as its empty-slot marker. A valid |
| 134 | // cached TypeMeta header cannot use reserved global-header bits, but an |
| 135 | // attacker-controlled cache lookup can happen before cold-path header |
| 136 | // validation, so this value must be forced to the miss path. |
| 137 | if (header != ulong.MaxValue && |
| 138 | _typeMetasByHeader.TryGetValue(header, out TypeMeta? cached) && |
| 139 | cached is not null) |
| 140 | { |
| 141 | typeMeta = cached; |
| 142 | return true; |
| 143 | } |
| 144 | |
| 145 | typeMeta = null!; |
| 146 | return false; |
| 147 | } |
| 148 | |
| 149 | internal void StoreRemoteTypeMeta(ulong header, TypeMeta typeMeta) |
| 150 | { |