1 /* 2 * PCF no-repad path: glyph extent past bitmap buffer 3 * 4 * The font stores bitmaps at the same glyph pad as the server requests 5 * (pad=4), so the RepadBitmap path is skipped. The original validation 6 * only checked that the glyph's offset was within the buffer, but not 7 * that the glyph's full extent (offset + width*height) fits. 8 * 9 * With the fix, the full glyph size is validated against the buffer. 10 * 11 * Test font: test/data/norepad/evil-norepad.pcf 12 * Generated by: test/gen_evil_pcf_norepad.py 13 */ 14 15 /* 16 * Copyright (c) 2026, Red Hat, Inc. 17 * 18 * Permission is hereby granted, free of charge, to any person obtaining a 19 * copy of this software and associated documentation files (the "Software"), 20 * to deal in the Software without restriction, including without limitation 21 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 22 * and/or sell copies of the Software, and to permit persons to whom the 23 * Software is furnished to do so, subject to the following conditions: 24 * 25 * The above copyright notice and this permission notice (including the next 26 * paragraph) shall be included in all copies or substantial portions of the 27 * Software. 28 * 29 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 32 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 34 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 35 * DEALINGS IN THE SOFTWARE. 36 */ 37 38 #include "pcf-test-common.h" 39 #include <stdio.h> 40 #include <stdlib.h> 41 42 int 43 main(int argc, char **argv) 44 { 45 xfont2_fpe_funcs_rec const **fpe_functions; 46 int fpe_function_count; 47 const char *builddir; 48 char fontdir[512]; 49 50 builddir = getenv("builddir"); 51 if (!builddir) 52 builddir = "."; 53 54 fpe_functions = pcf_test_init(&fpe_function_count); 55 56 snprintf(fontdir, sizeof(fontdir), "%s/test/data/norepad", builddir); 57 return pcf_test_open_font(fpe_functions, 58 "pcf-norepad-oob", 59 fontdir, 60 "-evil-norepad-medium-r-normal--10-100-75-75-c-80-iso10646-1"); 61 } 62