Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
Description
The code does the following:
if (NT_SUCCESS(status) || (status == STATUS_NO_MEDIA_IN_DEVICE))
{ cddata->XAFlags &= ~XA_USE_6_BYTE; /* Here seems we are overwritting the XAFlags */ cddata->XAFlags = XA_USE_READ_CD | XA_USE_10_BYTE; }else {
RtlCopyMemory(&cddata->u1.Header, buffer, sizeof(ERROR_RECOVERY_DATA10));
cddata->u1.Header.ModeDataLength = 0;
cddata->XAFlags &= ~XA_USE_6_BYTE;
cddata->XAFlags |= XA_USE_10_BYTE;
}
I've created a patch that changes:
/* Here seems we are overwritting the XAFlags */
cddata->XAFlags = XA_USE_READ_CD | XA_USE_10_BYTE;
to:
/* Let's add the XAFlags */
cddata->XAFlags |= XA_USE_READ_CD | XA_USE_10_BYTE;
I think the patch is not really needed since there are just 4 XA flags:
XA_USE_READ_CD
XA_USE_10_BYTE (exclusive with the following one)
XA_USE_6_BYTE (exclusive with the previous one)
XA_NOT_SUPPORTED
So:
cddata->XAFlags &= ~XA_USE_6_BYTE;
cddata->XAFlags |= XA_USE_READ_CD | XA_USE_10_BYTE;
will end with:
cddata->XAFlags = XA_USE_READ_CD | XA_USE_10_BYTE;
And the "buggie" code:
cddata->XAFlags &= ~XA_USE_6_BYTE;
/* Here seems we are overwritting the XAFlags */
cddata->XAFlags = XA_USE_READ_CD | XA_USE_10_BYTE;
will end with:
cddata->XAFlags = XA_USE_READ_CD | XA_USE_10_BYTE;
But i think the patch will reduce the false positives and clarify the situation.
Anyway, please review the code.
Thanks.