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

ImageFormatException: DHT has wrong length: 0 in PdfJsJpegDecoderCore #624

Closed
4 tasks done
denisivan0v opened this issue Jun 22, 2018 · 2 comments
Closed
4 tasks done
Labels

Comments

@denisivan0v
Copy link
Contributor

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Description

PdfJsJpegDecoderCore throws ImageFormatException with message DHT has wrong length: 0 for a correct jpeg image. Here is description of the one of those images:

$ identify -verbose 1.jpeg

Image: 1.jpeg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Mime type: image/jpeg
  Class: DirectClass
  Geometry: 1079x1080+0+0
  Units: Undefined
  Colorspace: sRGB
  Type: TrueColor
  Base type: Undefined
  Endianess: Undefined
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
  Channel statistics:
    Pixels: 1165320
    Red:
      min: 5  (0.0196078)
      max: 255 (1)
      mean: 226.69 (0.888979)
      standard deviation: 65.0998 (0.255293)
      kurtosis: 3.85376
      skewness: -2.37351
      entropy: 0.328066
    Green:
      min: 6  (0.0235294)
      max: 255 (1)
      mean: 203.244 (0.797036)
      standard deviation: 90.5669 (0.355164)
      kurtosis: -0.337993
      skewness: -1.273
      entropy: 0.319966
    Blue:
      min: 5  (0.0196078)
      max: 255 (1)
      mean: 203.818 (0.799288)
      standard deviation: 89.3192 (0.350271)
      kurtosis: -0.347884
      skewness: -1.27022
      entropy: 0.320873
  Image statistics:
    Overall:
      min: 5  (0.0196078)
      max: 255 (1)
      mean: 211.251 (0.828434)
      standard deviation: 81.662 (0.320243)
      kurtosis: 0.47284
      skewness: -1.55094
      entropy: 0.322968
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: JPEG
  Intensity: Undefined
  Compose: Over
  Page geometry: 1079x1080+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Orientation: Undefined
  Properties:
    date:create: 2018-06-22T15:00:41+07:00
    date:modify: 2018-06-22T14:47:29+07:00
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    signature: 10b2f139e0d1e2f440132a5a386faaf71d7f4ce71da2d69276c50ab04485d3de
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 49528B
  Number pixels: 1165320
  Pixels per second: 19.422MB
  User time: 0.040u
  Elapsed time: 0:01.059
  Version: ImageMagick 7.0.7-31 Q16 x86_64 2018-05-07 https://www.imagemagick.org

Steps to Reproduce

Call Image.Load for the one of attached images
images.zip

System Configuration

.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.300/

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba
  • ImageSharp version: 1.0.0-beta0004
  • Other ImageSharp packages and versions: SixLabors.ImageSharp.Drawing 1.0.0-beta0004
  • Environment (Operating system, version and so on): MacOS 10.12, Debian 9 (Linux)
  • .NET Framework version: .NET Core 2.1
@denisivan0v
Copy link
Contributor Author

Is there any fast workaround for this?

@JimBobSquarePants
Copy link
Member

Turns out we were throwing when we didn't need to. Those progressive images have DHT markers with no following data, but the code could already handle that. I'll merge the PR as soon as it builds.

@antonfirsov antonfirsov mentioned this issue Jun 22, 2018
4 tasks
antonfirsov added a commit to SixLabors/Imagesharp.Tests.Images that referenced this issue Jul 2, 2018
antonfirsov added a commit that referenced this issue Jul 2, 2018
antonfirsov added a commit to antonfirsov/ImageSharp that referenced this issue Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants