Opened 13 years ago Closed 13 years ago #602 closed defect (fixed)Division by small number leads to WP overflow
Description
In line 230 of WeighPredAnalysis.cpp, iRefAC may be small, leading to a large value of dWeight:
dWeight should be clipped to an appropriate range Attachments (1)Change History (4)comment:1 Changed 13 years ago by DefaultCC Plugin
comment:2 Changed 13 years ago by TanizawaChanged 13 years ago by Tanizawacomment:3 Changed 13 years ago by fbossen
Fixed in r2504 Note: See
TracTickets for help on using
tickets. | This list contains all users that will be notified about changes made to this ticket. These roles will be notified: Reporter, Owner, Subscriber, Participant
|
Since the worst case of actual weighting factor should be in the range of -256.0 to 255.0 when Log2Denom is 0,
The straightforward solution is to clip the range of -256.0 to 255.0.
The patch to fix this issue was provided.
The original code:
Double dWeight = (iRefAC==0) ? (Double)1.0 : ( (Double)(iCurrAC) / (Double)iRefAC);
The modified code:
Double dWeight = (iRefAC==0) ? (Double)1.0 : Clip3( -256.0, 255.0, ((Double)iCurrAC / (Double)iRefAC) );