Crash (access violation) in dgate when OHIF requests metadata of a compressed YBR_FULL ultrasound study - Conquest 1.5.0g / 1.5.0g4

  • Hello,

    I'm not a professional programmer, but I'd just like to point this out if it helps.
    I don't usually use forums, so I apologize if I'm not following any best practices.


    I found a null pointer dereference in dgate64.exe that crashes the server when OHIF requests the metadata of an ultrasound study.

    Versions
    - Reproduced on 1.5.0g (production) and on 1.5.0g4 (test, same behaviour).
    - Windows, 64-bit build.

    How to reproduce
    - Store a colour ultrasound study (PhotometricInterpretation = YBR_FULL) with the compression setting in dicom.ini enabled.
    - Open the study in the OHIF viewer integrated in Conquest.
    - The metadata endpoint answers, but dgate64.exe crashes with 0xc0000005. With uncompressed storage the crash does not occur.
    - K-PACS can query and view the same studies without problems.

    Analysis (1.5.0g crash dump)
    - Exception: read access violation at address 0x4 (null pointer), always at the same location (dgate64+0x5ad73).
    - The faulting instruction reads a length field at offset 4 of a pointer that is null. The code around it matches the YBR_FULL block in nkiqrsop.cpp.
    - In that block the result of GetVR(0x7fe0, 0x0010) (Pixel Data) is used without checking it for NULL:
    pVR = (*pDDO)->GetVR(0x7fe0, 0x0010);
    if(pVR->Length) DeYBRFULL((char *)pVR->Data, pVR->Length);
    The same pattern appears in the planar-configuration check a few lines above (around line 4436).
    - I could not determine why Pixel Data is missing at that point.

    Suggested fix
    - Check the pointer before using it, in both places:
    if(pVR && pVR->Length) noPlane = DePlane(...);
    if(pVR && pVR->Length) DeYBRFULL(...);
    Verification
    - I applied the equivalent change to the 1.5.0g binary (a two-byte patch that skips the dereference when the pointer is NULL). With it the server no longer crashes on the same request, and the images are displayed correctly in OHIF.


    Thank you for maintaining Conquest.

    Best regards,

    Luca

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!