https://bugs.openldap.org/show_bug.cgi?id=9191
Bug ID: 9191 Summary: libraries\liblutil\meter.c have a bad function lutil_meter_update, maybe divide 0 Product: OpenLDAP Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: --- Component: client tools Assignee: bugs@openldap.org Reporter: digpython@163.com Target Milestone: ---
int lutil_meter_update ( lutil_meter_t *meter, size_t position, int force) { static const double display_rate = 0.5; double frac, cycle_length, speed, now; time_t remaining_time, elapsed; int rc;
assert( meter != NULL );
lutil_get_now( &now );
if ( !force && now - meter->last_update < display_rate ) return 0;
frac = ((double)position) / ((double) meter->goal_value); elapsed = now - meter->start_time; if (frac <= 0.0) return 0; if (frac >= 1.0) { rc = meter->display->display_update( &meter->display_data, 1.0, 0, (time_t) elapsed, ((double)position) / elapsed); } else { ... }