FA-78981 / Image orientation metadata / Open access
Thumbnailer enlarges images smaller than the box · case 01
Tiny icons are blown up to the full thumbnail size.
ROOT CAUSE
The scale factor is not clamped at 1.
VERIFIED REPAIR
Include 1 in the minimum so small images keep their size.
Unsuccessful approach: Allowing 2x for high-density screens still upscales against the contract.
Case contract
Input [stored_w, stored_h, tag, box_w, box_h]. Compute the displayed thumbnail size: tags 5..8 swap the displayed dimensions (other values, including invalid tags, do not). Scale = min(box_w/dw, box_h/dh, 1) exactly (never upscale); each side is rounded half up and is at least 1 pixel.
Why this case matters
Camera, phone and scanner images carry an orientation hint separately from the stored pixels; galleries, thumbnailers, editors and upload pipelines must interpret it consistently or photos appear sideways, mirrored or doubly rotated.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
w, h, tag, bw, bh = x
if tag in (5, 6, 7, 8):
w, h = h, w
s = min(Fraction(bw, w), Fraction(bh, h))
tw = max(1, math.floor(w * s + Fraction(1, 2)))
th = max(1, math.floor(h * s + Fraction(1, 2)))
return [tw, th]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[25, 2, 6, 76, 343], [2, 25]], [[25, 2, 8, 231, 201], [2, 25]], [[5, 2, 2, 10, 2], [5, 2]], [[5, 4158, 8, 2, 2], [2, 1]], [[5, 1, 8, 10, 2], [1, 2]], [[2916, 3374, 8, 22, 164], [22, 19]], [[5, 27, 8, 10, 2], [10, 2]], [[3, 1, 6, 10, 10], [1, 3]]], [[[5, 2, 1, 19, 25], [5, 2]], [[5, 1, 1, 10, 26], [5, 1]], [[25, 7, 2, 2, 145], [2, 1]], [[15, 2, 0, 2, 2], [2, 1]], [[4728, 23, 5, 14, 18], [1, 18]], [[5, 4382, 0, 2, 337], [1, 337]], [[25, 7, 6, 2, 2], [1, 2]], [[17, 50, 7, 72, 27], [50, 17]]], [[[15, 1, 8, 10, 42], [1, 15]], [[15, 1, 6, 70, 32], [1, 15]], [[12, 1369, 3, 1, 30], [1, 30]], [[15, 1, 1, 11, 291], [11, 1]], [[2, 1, 3, 2, 2], [2, 1]], [[15, 1, 3, 2, 10], [2, 1]], [[1669, 12, 4, 2, 2], [2, 1]], [[25, 7, 7, 10, 345], [7, 25]]], [[[25, 1, 2, 288, 10], [25, 1]], [[5, 12, 9, 132, 13], [5, 12]], [[1283, 2, 6, 10, 2], [1, 2]], [[5, 2, 8, 2, 10], [2, 5]], [[25, 1230, 1, 10, 10], [1, 10]], [[3, 5, 2, 2, 22], [2, 3]], [[1584, 7, 0, 266, 9], [266, 1]], [[25, 1, 6, 10, 150], [1, 25]]], [[[5, 1, 0, 10, 2], [5, 1]], [[25, 7, 0, 65, 41], [25, 7]], [[3907, 2, 8, 28, 202], [1, 202]], [[25, 2, 4, 54, 2], [25, 2]], [[23, 49, 7, 23, 20], [23, 11]], [[3018, 47, 4, 2, 10], [2, 1]], [[15, 1, 2, 14, 14], [14, 1]], [[25, 2, 5, 103, 284], [2, 25]]]]
labels = ["regression: upscale clamp", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: upscale clamp 0 | [27, 343] | [2, 25] | Failed |
| repair trap 1 | [16, 201] | [2, 25] | Failed |
| combined fault 2 | [5, 2] | [5, 2] | Passed |
| control 3 | [2, 1] | [2, 1] | Passed |
| control 4 | [1, 2] | [1, 2] | Passed |
| boundary 5 | [22, 19] | [22, 19] | Passed |
| boundary 6 | [10, 2] | [10, 2] | Passed |
| control 7 | [3, 10] | [1, 3] | Failed |
SHA-256 / eeb072df10b73779257173a9353fc7671ff01a4322f27ae0c7ae58213210a6eb
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
w, h, tag, bw, bh = x
if tag in (5, 6, 7, 8):
w, h = h, w
s = min(Fraction(bw, w), Fraction(bh, h), Fraction(2))
tw = max(1, math.floor(w * s + Fraction(1, 2)))
th = max(1, math.floor(h * s + Fraction(1, 2)))
return [tw, th]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[25, 2, 6, 76, 343], [2, 25]], [[25, 2, 8, 231, 201], [2, 25]], [[5, 2, 2, 10, 2], [5, 2]], [[5, 4158, 8, 2, 2], [2, 1]], [[5, 1, 8, 10, 2], [1, 2]], [[2916, 3374, 8, 22, 164], [22, 19]], [[5, 27, 8, 10, 2], [10, 2]], [[3, 1, 6, 10, 10], [1, 3]]], [[[5, 2, 1, 19, 25], [5, 2]], [[5, 1, 1, 10, 26], [5, 1]], [[25, 7, 2, 2, 145], [2, 1]], [[15, 2, 0, 2, 2], [2, 1]], [[4728, 23, 5, 14, 18], [1, 18]], [[5, 4382, 0, 2, 337], [1, 337]], [[25, 7, 6, 2, 2], [1, 2]], [[17, 50, 7, 72, 27], [50, 17]]], [[[15, 1, 8, 10, 42], [1, 15]], [[15, 1, 6, 70, 32], [1, 15]], [[12, 1369, 3, 1, 30], [1, 30]], [[15, 1, 1, 11, 291], [11, 1]], [[2, 1, 3, 2, 2], [2, 1]], [[15, 1, 3, 2, 10], [2, 1]], [[1669, 12, 4, 2, 2], [2, 1]], [[25, 7, 7, 10, 345], [7, 25]]], [[[25, 1, 2, 288, 10], [25, 1]], [[5, 12, 9, 132, 13], [5, 12]], [[1283, 2, 6, 10, 2], [1, 2]], [[5, 2, 8, 2, 10], [2, 5]], [[25, 1230, 1, 10, 10], [1, 10]], [[3, 5, 2, 2, 22], [2, 3]], [[1584, 7, 0, 266, 9], [266, 1]], [[25, 1, 6, 10, 150], [1, 25]]], [[[5, 1, 0, 10, 2], [5, 1]], [[25, 7, 0, 65, 41], [25, 7]], [[3907, 2, 8, 28, 202], [1, 202]], [[25, 2, 4, 54, 2], [25, 2]], [[23, 49, 7, 23, 20], [23, 11]], [[3018, 47, 4, 2, 10], [2, 1]], [[15, 1, 2, 14, 14], [14, 1]], [[25, 2, 5, 103, 284], [2, 25]]]]
labels = ["regression: upscale clamp", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: upscale clamp 0 | [4, 50] | [2, 25] | Failed |
| repair trap 1 | [4, 50] | [2, 25] | Failed |
| combined fault 2 | [5, 2] | [5, 2] | Passed |
| control 3 | [2, 1] | [2, 1] | Passed |
| control 4 | [1, 2] | [1, 2] | Passed |
| boundary 5 | [22, 19] | [22, 19] | Passed |
| boundary 6 | [10, 2] | [10, 2] | Passed |
| control 7 | [2, 6] | [1, 3] | Failed |
SHA-256 / 537b5f94bd639a01dd64aa9df210296686ae01ff4eeb67de0d34f6b26aa2343a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
w, h, tag, bw, bh = x
if tag in (5, 6, 7, 8):
w, h = h, w
s = min(Fraction(bw, w), Fraction(bh, h), Fraction(1))
tw = max(1, math.floor(w * s + Fraction(1, 2)))
th = max(1, math.floor(h * s + Fraction(1, 2)))
return [tw, th]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[25, 2, 6, 76, 343], [2, 25]], [[25, 2, 8, 231, 201], [2, 25]], [[5, 2, 2, 10, 2], [5, 2]], [[5, 4158, 8, 2, 2], [2, 1]], [[5, 1, 8, 10, 2], [1, 2]], [[2916, 3374, 8, 22, 164], [22, 19]], [[5, 27, 8, 10, 2], [10, 2]], [[3, 1, 6, 10, 10], [1, 3]]], [[[5, 2, 1, 19, 25], [5, 2]], [[5, 1, 1, 10, 26], [5, 1]], [[25, 7, 2, 2, 145], [2, 1]], [[15, 2, 0, 2, 2], [2, 1]], [[4728, 23, 5, 14, 18], [1, 18]], [[5, 4382, 0, 2, 337], [1, 337]], [[25, 7, 6, 2, 2], [1, 2]], [[17, 50, 7, 72, 27], [50, 17]]], [[[15, 1, 8, 10, 42], [1, 15]], [[15, 1, 6, 70, 32], [1, 15]], [[12, 1369, 3, 1, 30], [1, 30]], [[15, 1, 1, 11, 291], [11, 1]], [[2, 1, 3, 2, 2], [2, 1]], [[15, 1, 3, 2, 10], [2, 1]], [[1669, 12, 4, 2, 2], [2, 1]], [[25, 7, 7, 10, 345], [7, 25]]], [[[25, 1, 2, 288, 10], [25, 1]], [[5, 12, 9, 132, 13], [5, 12]], [[1283, 2, 6, 10, 2], [1, 2]], [[5, 2, 8, 2, 10], [2, 5]], [[25, 1230, 1, 10, 10], [1, 10]], [[3, 5, 2, 2, 22], [2, 3]], [[1584, 7, 0, 266, 9], [266, 1]], [[25, 1, 6, 10, 150], [1, 25]]], [[[5, 1, 0, 10, 2], [5, 1]], [[25, 7, 0, 65, 41], [25, 7]], [[3907, 2, 8, 28, 202], [1, 202]], [[25, 2, 4, 54, 2], [25, 2]], [[23, 49, 7, 23, 20], [23, 11]], [[3018, 47, 4, 2, 10], [2, 1]], [[15, 1, 2, 14, 14], [14, 1]], [[25, 2, 5, 103, 284], [2, 25]]]]
labels = ["regression: upscale clamp", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: upscale clamp 0 | [2, 25] | [2, 25] | Passed |
| repair trap 1 | [2, 25] | [2, 25] | Passed |
| combined fault 2 | [5, 2] | [5, 2] | Passed |
| control 3 | [2, 1] | [2, 1] | Passed |
| control 4 | [1, 2] | [1, 2] | Passed |
| boundary 5 | [22, 19] | [22, 19] | Passed |
| boundary 6 | [10, 2] | [10, 2] | Passed |
| control 7 | [1, 3] | [1, 3] | Passed |
SHA-256 / 3c5409c2cacf94b85589f2fd9a127b903df104baa921f2acb945556ab290b3f7
Verification & scope
A deterministic bounded teaching model with a stipulated contract; it makes no claim of conformance to any published specification. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:49:40.481549+00:00.
Case digest / 1b4cd7ed8a86de38dc7aab58d0ecdfe46385d74fcea7ef1a45aa527a93303e34