Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

NULNUL coming as header

New Here ,
Jun 11, 2018 Jun 11, 2018

Copy link to clipboard

Copied

In our Application we have functionality to view / download PDF files Below is the code used for download and display in browser

> while ((readLength = bufInputStream.read(buf)) != -1) { outStream.write(buf, 0, readLength); } } 

recently we observed like getting popup like "There was an error opening this document. The file is damaged and could not be repaired."

when we checked the contents of good and bad pdf

good.pdf starts with "%PDF-1.6" ends with "%%EOF"

bad.pdf starts with "NULNULNULNUL%PDF-1.6" ends with "some number123456"

When we checked with Original PDF , which was streamed have proper header(without NUL)

We printed byte stream data and its coming as

First 500 bytes of PDF stream = [0, 0, 0, 0, 0, 0, 0, 0, 37, 80, 68, 70, 45, 49, 46, 51, 10, 37, -30, -29

  • when NUL NUL header added , why %%EOF Not appended to streamed data?
  • is there any setting we can add %%EOF by automatically to streamed data?
  • we need to do a code change for this?
  • there is any Acrobat or WebSphere  or loadbalancer or browser setting to resolve this issue?

Views

671
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 11, 2018 Jun 11, 2018

Copy link to clipboard

Copied

Not really about Reader. The PDF specification says %PDF must be st the first byte but some software accepts some extra bytes. You can choose to do the same.

%%EOF is required at the end. Nothing should be adding it to a stream. Sounds like your bad PDF is just bad 

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 12, 2018 Jun 12, 2018

Copy link to clipboard

Copied

Just want to know from experts on below items

  • What all possibilities for these NUL to be added in front of Header?
  • All data transmission  in encrypted mode(TLS)
  • Host file don't have these NUL characters
  • we tried to read data through wireshark , but due to encrpyted , we could not able to identify is it NUL or something else
  • Any softwares could help to get transmitted data ?
  • Temp fix has been added like add %%EOF at end of the file

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 12, 2018 Jun 12, 2018

Copy link to clipboard

Copied

metadata of the file has been changed from host and when download via application, what is possibility in change of metadata?

1.From Host file <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.1.1">

2.From App downloaded same file <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.2-c001 63.143651, 2012/04/05-09:01:49        ">

3.xap tag change to xmp when downloaded as below

file at host

<xap:ModifyDate>2018-05-21T08:35:15-04:00</xap:ModifyDate>

App downloaded same file

<xmp:ModifyDate>2018-05-09T22:15:42-04:00</xmp:ModifyDate>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 12, 2018 Jun 12, 2018

Copy link to clipboard

Copied

LATEST

I don't know what app or service you are talking about, so it's hard to say where you should find the experts. Clearly this is the wrong forum.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines