Skip to content
Heist/ feed
Back to feed
Medium

Security advisory

Type: advisorySources: OSVCVE: CVE-2021-46822

The PPM reader in libjpeg-turbo through 2.0.90 mishandles use of tjLoadImage for loading a 16-bit binary PPM file into a grayscale buffer and loading a 16-bit binary PGM file into an RGB buffer. This is related to a heap-based buffer overflow in the get_word_rgb_row function in rdppm.c.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2021-46822
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 13:02 UTC · Revision 1

Source evidence

CVE-2021-46822

core-osv · Original source

Published 18 Jun 2022, 16:15 UTC

The PPM reader in libjpeg-turbo through 2.0.90 mishandles use of tjLoadImage for loading a 16-bit binary PPM file into a grayscale buffer and loading a 16-bit binary PGM file into an RGB buffer. This is related to a heap-based buffer overflow in the get_word_rgb_row function in rdppm.c.

osv:CVE-2021-46822
Complete source record
{
  "id": "636dfbd148c79c20a6d28b3cbfdab3f06ebfb8e5eade4561123e65f2bdf174ab",
  "url": "https://osv.dev/vulnerability/CVE-2021-46822",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2021-46822",
    "summary": "The PPM reader in libjpeg-turbo through 2.0.90 mishandles use of tjLoadImage for loading a 16-bit binary PPM file into a grayscale buffer and loading a 16-bit binary PGM file into an RGB buffer. This is related to a heap-based buffer overflow in the get_word_rgb_row function in rdppm.c.",
    "evidence": "osv:CVE-2021-46822",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2021-46822",
      "aliases": [
        "CVE-2021-46822"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/libjpeg-turbo/libjpeg-turbo",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "last_affected": "4e52b66f342a803d3b8099b79607e3158d3a241c"
                },
                {
                  "fixed": "f35fd27ec641c42d6b115bfa595e483ec58188d2"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:libjpeg-turbo:libjpeg-turbo:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "last_affected": "2.0.90"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "f35fd27ec641c42d6b115bfa595e483ec58188d2"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "jpeg-6b",
            "2.0.90",
            "2.0.0",
            "1.5.90",
            "1.5.0",
            "1.4.90",
            "jpeg-6a",
            "jpeg-6",
            "jpeg-5b",
            "jpeg-5a",
            "jpeg-5",
            "jpeg-4a",
            "jpeg-4",
            "jpeg-3",
            "jpeg-2",
            "jpeg-1",
            "1.3.90",
            "1.2.90",
            "1.1.90",
            "1.0.1",
            "1.0.90",
            "1.0.0",
            "0.0.93",
            "0.0.91",
            "0.0.90"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-46822.json",
            "vanir_signatures": [
              {
                "id": "CVE-2021-46822-692d368f",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "154550684937007978792065401036434341956",
                    "34849433911376459619790736472170818814",
                    "281695252477769122714200495655720896267",
                    "120533593229279907622435113682742146338",
                    "187701529453313185003093589009297679654",
                    "14934939567025485057297003720762987776",
                    "301088263237368198422355583340185968111",
                    "160364715725206012533217877395764884215",
                    "277312511432121514880445334256442317583",
                    "215631509190130614950731538068129801662",
                    "14934939567025485057297003720762987776",
                    "301088263237368198422355583340185968111",
                    "160364715725206012533217877395764884215",
                    "277312511432121514880445334256442317583",
                    "215631509190130614950731538068129801662",
                    "14934939567025485057297003720762987776",
                    "109725220448925549931635803942821075455",
                    "307520553355166449773085376864574377107",
                    "250930862893698800802467478106603718999",
                    "118080646153056444353964411301831564746",
                    "141659211143879742304022490176222501022",
                    "198516492182538729912405465337904091103",
                    "217106799193293312340383186906426194131",
                    "7397032083592044428714565800923071329",
                    "151504451180928648502687094723131443583",
                    "139317428699747889858124752718420697288",
                    "64985835885397232212285452255761324306"
                  ]
                },
                "source": "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/f35fd27ec641c42d6b115bfa595e483ec58188d2",
                "target": {
                  "file": "rdppm.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2021-46822-6f698acc",
                "digest": {
                  "length": 932,
                  "function_hash": "182312530622160650449074891296046880301"
                },
                "source": "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/f35fd27ec641c42d6b115bfa595e483ec58188d2",
                "target": {
                  "file": "rdppm.c",
                  "function": "get_word_rgb_row"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2021-46822-cedc80d1",
                "digest": {
                  "length": 4737,
                  "function_hash": "236958233622389590308291619840792029626"
                },
                "source": "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/f35fd27ec641c42d6b115bfa595e483ec58188d2",
                "target": {
                  "file": "rdppm.c",
                  "function": "start_input_ppm"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              }
            ],
            "vanir_signatures_modified": "2026-10-20T14:31:44Z"
          }
        }
      ],
      "modified": "2026-10-20T14:31:44.365305512Z",
      "provider": "osv",
      "references": [
        "https://exchange.xforce.ibmcloud.com/vulnerabilities/221567",
        "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/f35fd27ec641c42d6b115bfa595e483ec58188d2"
      ],
      "provider_metadata": {}
    },
    "related_cves": [
      {
        "value": "CVE-2021-46822",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 389704,
  "published_at": "2022-06-18T16:15:08.11+00:00"
}