Skip to content

findOutline4 function does not check itself for nonMaskValue #44

@derek-rocheleau

Description

@derek-rocheleau

void MaskAnalyzer::findOutline4(const uint8_t* mask, const unsigned int width, const unsigned int height, const unsigned int maskPaddingElements, PixelPositions& outlinePixels4, const PixelBoundingBox& boundingBox, const uint8_t nonMaskValue)

The output for this function is described as this:

Resulting outline-4 pixels, the pixel itself is not a mask pixel but has at least one neighbor mask pixel in the four-neighborhood

But nowhere does it ensure that the pixel being analyzed is not a mask pixel. As a result the output contains all of the mask pixels in addition to the outline pixels. See Line 381 for example:

if (maskRow[x - 1u] != nonMaskValue || maskRow[x + 1u] != nonMaskValue || maskRowBottom[x] != nonMaskValue)

It is done correctly in other functions, such as here in Line 1784:

if (row1[x] != nonMaskValue && (row1[x - 1u] == nonMaskValue || row1[x + 1u] == nonMaskValue || row0[x] == nonMaskValue || row2[x] == nonMaskValue))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions