Skip to content

json: unsupported value: +Inf when indexing files with embedded images that have ExposureTime=0 #3267

Description

@wuast94

getPhoto() in tika.go divides by the parsed exif:ExposureTime value without checking for zero:

photo.SetExposureDenominator(math.Round(1 / i))

When i == 0, this produces +Inf, which causes json.Marshal to fail:

failed to marshal resource: json: error calling MarshalJSON for type *libregraph.Photo: json: unsupported value: +Inf

This happens with files containing embedded images that have default/zeroed EXIF data (e.g. ONLYOFFICE sample PPTX files, where Tika returns exif:ExposureTime: "0.0" for all 8 embedded placeholder images).

The affected file never gets indexed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions