Page MenuHome

Scaling up 1x1 pixel image reads past buffer bounds
Closed, ResolvedPublicBUG


This Python script causes an ASAN error:

import imbuf, 1)).resize((2, 2), 'BILINEAR')

Although this isn't limited to Python, the error happens when IMB_scaleImBuf is called on a 1x1 pixel image from anywhere in Blender.

Currently the function assumes there is always a 'next' pixel.

Event Timeline

Campbell Barton (campbellbarton) lowered the priority of this task from 90 to Low.Sep 29 2019, 4:28 PM
Campbell Barton (campbellbarton) updated the task description. (Show Details)

I can't replicate this on my machine, could you provide some more instructions? It runs the script fine on my PC, so I might be doing something wrong

The error happens with address sanitizer enabled, use WITH_COMPILER_ASAN, although it's not available on all platforms.

Just from checking the code you can see it assumes a second pixel exists.

Oh, I hadn't used that flag for the compilation, thanks! What would be the expected outcome of this, I don't quite understand what is the ImBuf structure, even after toying with it this summer.

Sybren A. Stüvel (sybren) changed the task status from Confirmed to Needs Information from User.Feb 11 2020, 12:15 PM

I can't reproduce this in current master (be8879718e24e417d299eb298b8a9d4d2ca324ee), even with WITH_COMPILER_ASAN. @Campbell Barton (campbellbarton) is this still an issue?

Tested and it's still an issue, although since this report 'BILINEAR' needs to be passed to redo this error (updated code snipped).

Bastien Montagne (mont29) changed the subtype of this task from "Report" to "Bug".Feb 26 2020, 5:55 PM
Germano Cavalcante (mano-wii) changed the task status from Needs Information from User to Confirmed.Mar 11 2020, 8:09 PM