comparison dvdnav.c @ 428:10c91a9d6a2e src

Fix integer overflow in dvdnav_convert_time(). Currently the calculation will use int and thus overflow for anything larger or equal to 20 hours. Patch by Reimar Dffinger %Reimar^Doeffinger&gmx*de!
author rathann
date Thu, 03 Oct 2013 22:39:38 +0000
parents ff5f3e53459b
children
comparison
equal deleted inserted replaced
427:c53e528905ec 428:10c91a9d6a2e
201 /* converts a dvd_time_t to PTS ticks */ 201 /* converts a dvd_time_t to PTS ticks */
202 int64_t dvdnav_convert_time(dvd_time_t *time) { 202 int64_t dvdnav_convert_time(dvd_time_t *time) {
203 int64_t result; 203 int64_t result;
204 int64_t frames; 204 int64_t frames;
205 205
206 result = (time->hour >> 4 ) * 10 * 60 * 60 * 90000; 206 result = (time->hour >> 4 ) * 10 * 60 * 60 * 90000ull;
207 result += (time->hour & 0x0f) * 60 * 60 * 90000; 207 result += (time->hour & 0x0f) * 60 * 60 * 90000;
208 result += (time->minute >> 4 ) * 10 * 60 * 90000; 208 result += (time->minute >> 4 ) * 10 * 60 * 90000;
209 result += (time->minute & 0x0f) * 60 * 90000; 209 result += (time->minute & 0x0f) * 60 * 90000;
210 result += (time->second >> 4 ) * 10 * 90000; 210 result += (time->second >> 4 ) * 10 * 90000;
211 result += (time->second & 0x0f) * 90000; 211 result += (time->second & 0x0f) * 90000;