Skip to content
Snippets Groups Projects
  • Indu Bhagat's avatar
    cd9aea32
    libsframe: adjust an incorrect check in flip_sframe · cd9aea32
    Indu Bhagat authored
    When sframe_encoder_write needs to flip the buffer containing the SFrame
    section before writing, it is not necessary that the SFrame FDES are in
    the order of their sfde_func_start_fre_off.  On the contrary, SFrame
    FDEs will be sorted in the order of their start address.  So, remove
    this incorrect assumption which is basically assuming that the last
    sfde_func_start_fre_off seen will help determine the end of the flipped
    buffer.
    
    The function now keeps track of the bytes_flipped and then compares it with
    the expected value.  Also, added two more checks at appropriate places:
     - check that the SFrame FDE read is within bounds
     - check that the SFrame FRE read is within bounds
    
    libsframe/
    
    	* sframe.c (flip_sframe): Adjust an incorrect check.
    	Add other checks to ensure reads are within the buffer size.
    cd9aea32
    History
    libsframe: adjust an incorrect check in flip_sframe
    Indu Bhagat authored
    When sframe_encoder_write needs to flip the buffer containing the SFrame
    section before writing, it is not necessary that the SFrame FDES are in
    the order of their sfde_func_start_fre_off.  On the contrary, SFrame
    FDEs will be sorted in the order of their start address.  So, remove
    this incorrect assumption which is basically assuming that the last
    sfde_func_start_fre_off seen will help determine the end of the flipped
    buffer.
    
    The function now keeps track of the bytes_flipped and then compares it with
    the expected value.  Also, added two more checks at appropriate places:
     - check that the SFrame FDE read is within bounds
     - check that the SFrame FRE read is within bounds
    
    libsframe/
    
    	* sframe.c (flip_sframe): Adjust an incorrect check.
    	Add other checks to ensure reads are within the buffer size.