Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

uniontech-lilinjie
Copy link
Contributor

Signed-off-by: lilinjie [email protected]
fix typo

Signed-off-by: lilinjie <[email protected]>
chris-liddell pushed a commit that referenced this pull request Jan 25, 2024
Item #1 of the report. This looks like an oversight when first coding
the routine. We should use the PostScript string length, because
PostScript strings may not be NULL terminated (and as here may contain
internal NULL characters).

Fix the R6 handler which has the same problem too.
Mik4sa pushed a commit to Com-In-GmbH-Co-KG-Consulting-Solutions/ghostpdl that referenced this pull request Sep 20, 2024
When building a sanitize build with fontconfig support enabled, and
executing the gs binary on the ossfuzz-68423 sample file like so:

  ./sanbin/gs -K1048576 -r200x200 -sBandListStorage=memory -dMaxBitmap=0 \
    -dBufferSpace=450k -dMediaPosition=1 -dcupsColorSpace=1 -dQUIET \
    -dSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS \
    -sstdout=%%stderr -sOutputFile=/dev/null -sDEVICE=eps2write \
    ossfuzz-68423.pdf

ASAN complains about overlapping source and destination memory
regions to memcpy:

ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges
    #0 0x7ffff78f15dd in memcpy
    ArtifexSoftware#1 0x555557ba06af in pdfi_type1_add_to_native_map pdf/pdf_fmap.c:364
    ArtifexSoftware#2 0x555557ba249c in pdfi_add_font_to_native_map pdf/pdf_fmap.c:711
    ArtifexSoftware#3 0x555557ba2786 in pdfi_generate_platform_fontmap pdf/pdf_fmap.c:746
    #4 0x555557ba30a9 in pdfi_generate_native_fontmap pdf/pdf_fmap.c:810
    #5 0x555557ba340b in pdf_fontmap_lookup_font pdf/pdf_fmap.c:904
    #6 0x555557b354cf in pdfi_load_font_file pdf/pdf_font.c:837
    #7 0x555557b37f7c in pdfi_load_font pdf/pdf_font.c:1140
    #8 0x555557b387b1 in pdfi_load_dict_font pdf/pdf_font.c:1192
    #9 0x555557b38b15 in pdfi_load_resource_font pdf/pdf_font.c:1234
    #10 0x555557b3b417 in pdfi_Tf pdf/pdf_font.c:1593
    #11 0x555557a8ae5a in pdfi_interpret_stream_operator pdf/pdf_int.c:1637
    #12 0x555557a8e5bb in pdfi_interpret_content_stream pdf/pdf_int.c:2124
    #13 0x555557af2d17 in pdfi_process_page_contents pdf/pdf_page.c:132
    #14 0x555557af2f73 in pdfi_process_one_page pdf/pdf_page.c:156
    #15 0x555557afaa69 in pdfi_page_render pdf/pdf_page.c:1031
    #16 0x555557a50cb7 in zPDFdrawpage psi/zpdfops.c:959
    #17 0x555557884569 in do_call_operator psi/interp.c:91
    #18 0x5555578920df in interp psi/interp.c:1768
    #19 0x555557886204 in gs_call_interp psi/interp.c:531
    #20 0x55555788590d in gs_interpret psi/interp.c:488
    #21 0x555557859d02 in gs_main_interpret psi/imain.c:257
    #22 0x55555785e9ee in gs_main_run_string_end psi/imain.c:945
    #23 0x55555785e45b in gs_main_run_string_with_length psi/imain.c:889
    #24 0x55555785e3cd in gs_main_run_string psi/imain.c:870
    #25 0x55555786b359 in run_string psi/imainarg.c:1174
    #26 0x55555786b07c in runarg psi/imainarg.c:1133
    #27 0x55555786a8fd in argproc psi/imainarg.c:1055
    #28 0x555557864d41 in gs_main_init_with_args01 psi/imainarg.c:243
    #29 0x55555786517e in gs_main_init_with_args psi/imainarg.c:290
    #30 0x5555578708eb in psapi_init_with_args psi/psapi.c:281
    #31 0x555557c03f89 in gsapi_init_with_args psi/iapi.c:253
    #32 0x555555c66dad in main psi/gs.c:95

Running gdb verifies that the pname and namestr variables in
pdfi_type1_add_to_native_map() overlap and the simple fix is
to instead call memmove().
@Neustradamus
Copy link

Dear @robinwatts, @chris-liddell,

Have you seen this @uniontech-lilinjie PR?

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants