Skip to content

[syncfusion_flutter_pdf]Potential Null Reference Error in pdf_pkcs_certificate.dart #1323

@motucraft

Description

@motucraft

I've identified a potential issue in the file pdf_pkcs_certificate.dart, specifically in this section:

      if (mechanism != null && mechanism!.startsWith('PBEwithMD2') ||
          mechanism!.startsWith('PBEwithMD5') ||
          mechanism!.startsWith('PBEwithSHA-1') ||
          mechanism!.startsWith('PBEwithSHA-256')) {
        if (mechanism!.endsWith('AES-CBC-BC') ||
            mechanism!.endsWith('AES-CBC-OPENSSL')) {
          result = _cipherUtils.getCipher('AES/CBC');
        } else if (mechanism!.endsWith('DES-CBC')) {
          result = _cipherUtils.getCipher('DES/CBC');
        } else if (mechanism!.endsWith('DESEDE-CBC')) {
          result = _cipherUtils.getCipher('DESEDE/CBC');
        } else if (mechanism!.endsWith('RC2-CBC')) {
          result = _cipherUtils.getCipher('RC2/CBC');
        } else if (mechanism!.endsWith('RC4')) {
          result = _cipherUtils.getCipher('RC4');
        }
      }

This code has the potential to throw "Unhandled Exception: Null check operator used on a null value" if mechanism is null.

Link to the file: pdf_pkcs_certificate.dart

Metadata

Metadata

Assignees

No one assigned

    Labels

    pdfPDF component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions