aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-02-14 12:40:23 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-02-14 12:40:23 +0100
commit80912aec18f49f097de3d0970ed8f1eab805d4de (patch)
tree943227bc8f5344131707f50e83447d4180004319
parent2e016dd4a44771184a13ebd55d5b3f294b99751b (diff)
edid-decode: fix 32 bit overflow
The calculation of the min/max pixelclock had a 32 bit overflow. Cast the factor 1000 to unsigned long long (1000ULL). Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--edid-decode.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/edid-decode.cpp b/edid-decode.cpp
index 5d55c0b..b6ec93f 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -486,8 +486,8 @@ bool edid_state::print_timings(const char *prefix, const struct timings *t,
max_vert_freq_hz = max(max_vert_freq_hz, refresh);
}
if (pixclk_khz && (t->hact + hbl)) {
- min_hor_freq_hz = min(min_hor_freq_hz, (pixclk_khz * 1000) / (t->hact + hbl));
- max_hor_freq_hz = max(max_hor_freq_hz, (pixclk_khz * 1000) / (t->hact + hbl));
+ min_hor_freq_hz = min(min_hor_freq_hz, (pixclk_khz * 1000ULL) / (t->hact + hbl));
+ max_hor_freq_hz = max(max_hor_freq_hz, (pixclk_khz * 1000ULL) / (t->hact + hbl));
max_pixclk_khz = max(max_pixclk_khz, pixclk_khz);
}

Privacy Policy