Changeset 6041


Ignore:
Timestamp:
Jul 19, 2019 9:05:23 AM (5 years ago)
Author:
riza
Message:

Re #2210 (misc): Prevent overflow when searching for the closest video format.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/vid_port.c

    r5982 r6041  
    351351        if (diff_width1 <= diff_width2) { 
    352352            int k = 1; 
    353             pjmedia_rect_size tmp_size = vfd->size;          
    354  
    355             while(((GET_DIFF(tmp_size.w, req_fmt_size->w) < 
    356                    (GET_DIFF(nearest_width[k].w, req_fmt_size->w))) &&  
    357                   (k < PJ_ARRAY_SIZE(nearest_width))))           
     353            pjmedia_rect_size tmp_size = vfd->size; 
     354 
     355            while(((k < PJ_ARRAY_SIZE(nearest_width)) && 
     356                   (GET_DIFF(tmp_size.w, req_fmt_size->w) < 
     357                   (GET_DIFF(nearest_width[k].w, req_fmt_size->w))))) 
    358358            { 
    359359                nearest_width[k-1] = nearest_width[k]; 
     
    361361            } 
    362362            nearest_width[k-1] = tmp_size; 
    363         }                
     363        } 
    364364    } 
    365365    /* No need to calculate ratio if exact match is found. */ 
Note: See TracChangeset for help on using the changeset viewer.