UB shift 1<<biBitCount in splash_bmp ncols computation (folded into DF-1857 fix)
| Field | Value |
|---|---|
| ID | DF-1859 |
| Status | new |
| Severity | Info |
| CVSS 3.1 | CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:L |
| CWE | CWE-758 Reliance on Undefined Behavior |
| File | sys/dev/video/fb/bmp/splash_bmp.c |
| Lines | 538 |
| Area | dev/video (boot splash BMP parser) |
| Confidence | speculative |
| Discovered | 2026-07-20 |
| Reported | pending |
| Known CVE | none |
| CVE match | dfly_specific |
Summary
At line 538, bmp_info.ncols = 1 << bmf->bmfi.bmiHeader.biBitCount; performs a
left shift of a signed int by an attacker-controlled count. For
biBitCount >= 32 (or negative), this is undefined behavior in C.
Root cause
biBitCount (short, line 191) is taken directly from the attacker file (line
521 sets depth from it, but line 538 uses the raw header field).
1 << biBitCount with biBitCount in [9,31] yields 512..2^31 which is then
caught by ncols > (1<<sdepth) (sdepth<=8 β 256), so those are rejected.
biBitCount >= 32 is UB; biBitCount < 0 is also UB-ish and would make ncols
a small/garbage value but the loop at 550 then doesn't execute meaningfully.
Threat model & preconditions
Same as DF-1857: control of the boot splash asset. No demonstrated memory unsafety beyond theoretical UB.
Recommended fix
Fixed for free by DF-1857's proposed depth-validation block
(if (depth != 1 && depth != 4 && depth != 8) return 1;) which rejects bad
shifts before line 538 is reached.
Timeline
- 2026-07-20 Discovered during automated audit.
- 2026-07-20 Reported to DragonFlyBSD security contact (pending).
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1859 Β· 1 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | UB shift 1<<biBitCount in splash_bmp ncols computation (folded into DF-1857 fix) | 548 B | view raw |
Fix verification
fixedfix.diff applied + combined nativekernel build rc=0 (-Werror)
fix.diff applied + combined nativekernel build rc=0 (-Werror)
Confirmed kernel references
β
Detail
Exploit chain
none (Info severity)
Evidence (decisive lines)
Source-confirmed at sys/dev/video/fb/bmp/splash_bmp.c:538: UB shift 1<<biBitCount in ncols computation
Verified recommended fix
Source-confirmed at sys/dev/video/fb/bmp/splash_bmp.c:538: UB shift 1<<biBitCount in ncols computation
Verdict
Source-confirmed at sys/dev/video/fb/bmp/splash_bmp.c:538: UB shift 1<<biBitCount in ncols computation
No comments yet.