Commit 140e24f
Fix past-end-of-cache handling in includeCache.ExpectFile
The comments state that if ExpectFile() is called, but there are no
remaining items in the cache, it will invalidate the cache. However, the
code would only invalidate the cache if at least one item was still
present, but it didn't match the expected file. In practice, this
wouldn't usually cause issues, since adding a new file would usually
cause an invalid cache earlier on, and even if a new file was added at
the end of the compilation, it would not be in the .d file, so it would
be marked as "changed".
However, in rare circumstances, such as when the include cache would not
be properly generated due to other problems (see #230), this would cause
a crash, when ExpectFile did not invalidate the cache and the file in
question was unchanged, causing an out-of-bounds read from the cache.
This commit fixes this by making ExpectFile behave like documented and
invalidate the cache when there are no remaining entries.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>1 parent e7600b5 commit 140e24f
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| |||
0 commit comments