Commit 320b88d3 authored by jsgh's avatar jsgh

Avoid division-by-zero when tmap search returns two tmap entries

with the same vobu_idx (which can happen at the end of a title).
parent ed3d4c31
Pipeline #8852 failed with stage
in 2 minutes and 50 seconds
......@@ -1094,8 +1094,14 @@ static int32_t dvdnav_tmap_calc_time_for_tmap_entry(dvdnav_jump_args_t *args,
}
/* calc position of cell relative to lo */
if (hi->vobu_idx == lo->vobu_idx) {
/* We are at the very end - pos should also equal lo so force that
* rather than hit the divide-by-zero. */
vobu_pct = 0;
} else {
vobu_pct = ((pos->vobu_idx - lo->vobu_idx) * 1000)
/ ( hi->vobu_idx - lo->vobu_idx);
}
if (vobu_pct < 0 || vobu_pct > 1000) {
fprintf(MSG_OUT, "vobu_pct must be between 0 and 1000");
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment