Image:sample() returns phantom values

The playdate playdate.image:sample() method returns invalid values for pixels at x = IMAGE_WIDTH and y = IMAGE_HEIGHT (numbering from zero, these are outside bounds of the image). The issue is reproducible both on Mac Simulator and on device (2.5.0).

For example, this code returns a color instead of nil:

local img = gfx.image.new(3, 3)
img:sample(3, 3) -- returns 2 instead of nil

The method returns nil for all other values outside bounds of the image, but for those N+1 coords it always returns gfx.kColorTransparent value.

I created an example that shows it in more detail bug.pdx.zip (10.8 KB):

function samplePixels(img)
	local sampleResults = {}

	-- intentionally sample the nonexistent fourth pixel
	for x = 0, 3 do
		sampleResults[x] = {}
		for y = 0, 3 do
			sampleResults[x][y] = img:sample(x, y)
		end
	end

	printTable(sampleResults)
end

local gfx = playdate.graphics

-- creating a white-filled image to highlight the wrong values
-- the issue show for transparent images, too
local img = gfx.image.new(3, 3, gfx.kColorWhite)
samplePixels(img)

-- result:
-- {
--   { 1, 1, 1, 2 },
--   { 1, 1, 1, 2 },
--   { 1, 1, 1, 2 },
--   { 2, 2, 2, 2 },
-- }

gfx.pushContext(img)
gfx.drawRect(0, 0, 3, 3)
gfx.popContext()
samplePixels(img)

-- result:
-- {
--   { 0, 0, 0, 2 },
--   { 0, 1, 0, 2 },
--   { 0, 0, 0, 2 },
--   { 2, 2, 2, 2 },
-- }