Skip to content

imgcodecs: avoid vulnerabilities in Jasper codec (JPEG-2000) #14058

@alalek

Description

@alalek

Jasper project has many opened vulnerabilities which are not get fixed for a long time.
Especially in version 1.900 which is used by OpenCV.

It is not safe to open external/untrusted JPEG-2000 images via imread()/imdecode().
Perhaps it is not save to use encoder too via imwrite()/imencode().

Possible alternative to Jasper codec is OpenJPEG, which should replace Jasper in OpenCV in the future.

Changes:

  • Add runtime option OPENCV_IO_ENABLE_JASPER.
    Turned OFF by default (for current outdated code of Jasper 1.900).
    Prevents calling of Jasper code from OpenCV, prints warning message with the link on this issue.
    Users are still able to turn ON this option during runtime. Use it at your own risk!
    PR: imgcodecs: OPENCV_IO_ENABLE_JASPER runtime parameter #14059
    OpenCV versions: 3.4.6+ / 4.1.0+

  • Change CMake defaults: BUILD_JASPER=OFF.
    TBD

  • Change CMake defaults: WITH_JASPER=OFF
    TBD


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions