Skip to content

Underflow in YUV to RGB conversion #8

@Memotech-Bill

Description

@Memotech-Bill

In routine parse_im (file "video_capture.c") you protect against the calculated values of RGB being greater than 255, and clip them to this maximum value. However you do not protect against them going negative (which can happen in dark areas of the image).

The code needs to be extended as:

        if(B > UCHAR_MAX){
            B = UCHAR_MAX;
        } else if(B < 0){
            B = 0;
        }
        if(G > UCHAR_MAX){
            G = UCHAR_MAX;
        } else if(G < 0){
            G = 0;
        }
        if(R > UCHAR_MAX){
            R = UCHAR_MAX;
        } else if(R < 0){
            R = 0;
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions