github / github/codeql

Missing size for typedef

Open
#8,805 0 comments 0 reactions 0 assignees View on GitHub
bug C++
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

At least in some situations, the database can wind up with a `Type` with no size, even though that `Type` is for a `typedef` whose underlying type has a known size. This caused bad IR generation, although that was fixable by always using the size of the unspecified type.

To repro, run the following query on the LGTM database for g/nlohmann/json:

```ql
private import cpp

from Type t, Type ut, int size
where ut = t.getUnspecifiedType() and size = ut.getSize() and not exists(t.getSize())
select t, ut, size
```

Expected Result:
No results

Actual Result:
~871 types for which there is no size, despite the unspecified type having a size

I was unable to come up with a small repro in a QL test, so it might be tricky to debug.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.