diff --git a/channels/rdpear/common/test/TestNdrEar.c b/channels/rdpear/common/test/TestNdrEar.c index 85baab14c..6d7dbaa0a 100644 --- a/channels/rdpear/common/test/TestNdrEar.c +++ b/channels/rdpear/common/test/TestNdrEar.c @@ -143,100 +143,155 @@ fail: return rc; } +static BOOL run_payload(NdrContext* context, const BYTE* payload4, size_t sizeofPayload4) +{ + WINPR_ASSERT(context); + + if (!payload4) + return FALSE; + + CreateApReqAuthenticatorReq createApReqAuthenticatorReq = { 0 }; + + wStream staticS = { 0 }; + wStream* s = Stream_StaticInit(&staticS, payload4, sizeofPayload4); + if (!ndr_skip_bytes(context, s, 4)) /* skip union id */ + return FALSE; + if (!ndr_read_CreateApReqAuthenticatorReq(context, s, NULL, &createApReqAuthenticatorReq)) + return FALSE; + if (!ndr_treat_deferred_read(context, s)) + return FALSE; + if (createApReqAuthenticatorReq.KeyUsage != 7) + return FALSE; + if (!createApReqAuthenticatorReq.EncryptionKey) + return FALSE; + if (createApReqAuthenticatorReq.SubKey) + return FALSE; + if (!createApReqAuthenticatorReq.ClientName) + return FALSE; + if (createApReqAuthenticatorReq.ClientName->nameHints.count != 1) + return FALSE; + if (!createApReqAuthenticatorReq.ClientRealm) + return FALSE; + if (!createApReqAuthenticatorReq.AuthData) + return FALSE; + if (createApReqAuthenticatorReq.AuthData->Asn1BufferHints.count != 2) + return FALSE; + if (!createApReqAuthenticatorReq.SkewTime) + return FALSE; + if (createApReqAuthenticatorReq.SkewTime->QuadPart != 0) + return FALSE; + + ndr_destroy_CreateApReqAuthenticatorReq(context, NULL, &createApReqAuthenticatorReq); + ndr_context_reset(context); + return TRUE; +} + static int TestNdrEarRead(int argc, char* argv[]) { WINPR_UNUSED(argc); WINPR_UNUSED(argv); - int retCode = -2; + int retCode = -1; /* ====================================================================== */ NdrContext* context = ndr_context_new(FALSE, 1); if (!context) return -1; - wStream staticS = { 0 }; - wStream* s = NULL; + { + retCode = -2; + const BYTE payload[] = { + 0x00, 0x00, 0x00, 0x00, // (PduType) + 0x02, 0x00, 0x00, 0x00, // (Length) + 0x28, 0x00, 0x02, 0x00, // (Asn1Buffer) -#if 0 - BYTE payload[] = { - 0x00, 0x00, 0x00, 0x00, // (PduType) - 0x02, 0x00, 0x00, 0x00, // (Length) - 0x28, 0x00, 0x02, 0x00, // (Asn1Buffer) + // == conformant array == + 0x02, 0x00, 0x00, 0x00, // (nitems) + 0x30, 0x00, // content + 0x00, 0x00 // (padding) + }; - // == conformant array == - 0x02, 0x00, 0x00, 0x00, // (nitems) - 0x30, 0x00, // content - 0x00, 0x00 // (padding) - }; - s = Stream_StaticInit(&staticS, payload, sizeof(payload)); + wStream staticS = { 0 }; + wStream* s = Stream_StaticInit(&staticS, payload, sizeof(payload)); - KERB_ASN1_DATA asn1 = { 0 }; - if (!ndr_read_KERB_ASN1_DATA(context, s, NULL, &asn1) || !ndr_treat_deferred_read(context, s) || - asn1.Asn1BufferHints.count != 2 || *asn1.Asn1Buffer != 0x30) - goto out; - KERB_ASN1_DATA_destroy(context, &asn1); - ndr_context_reset(context); + KERB_ASN1_DATA asn1 = { 0 }; + if (!ndr_read_KERB_ASN1_DATA(context, s, NULL, &asn1) || + !ndr_treat_deferred_read(context, s) || asn1.Asn1BufferHints.count != 2 || + *asn1.Asn1Buffer != 0x30) + goto out; + ndr_destroy_KERB_ASN1_DATA(context, NULL, &asn1); + ndr_context_reset(context); + + /* ====================================================================== */ + } + { + retCode = -3; + const BYTE payload2[] = { + // ------------ a RPC_UNICODE_STRING: Administrateur ------------------------- + 0x1c, 0x00, // (Length) + 0x1e, 0x00, // (MaximumLength) + 0x1c, 0x00, 0x02, 0x00, // (Buffer ptr) + // == conformant array == + 0x0f, 0x00, 0x00, 0x00, // (maximum count) + 0x00, 0x00, 0x00, 0x00, // (offset) + 0x0e, 0x00, 0x00, 0x00, // (length) + + 0x48, 0x00, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x49, 0x00, + 0x4e, 0x00, 0x47, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00, + 0x00, 0x00, + + 0x00, 0x00 + }; + + wStream staticS = { 0 }; + wStream* s = Stream_StaticInit(&staticS, payload2, sizeof(payload2)); + RPC_UNICODE_STRING unicode = { 0 }; + if (!ndr_read_RPC_UNICODE_STRING(context, s, NULL, &unicode) || + !ndr_treat_deferred_read(context, s)) + goto out; + ndr_destroy_RPC_UNICODE_STRING(context, NULL, &unicode); + ndr_context_reset(context); + } + { + retCode = -4; + /* ====================================================================== */ + const BYTE payload3[] = { + // ------------ an KERB_RPC_INTERNAL_NAME: HARDENING3.COM ------------------------- + 0x01, 0x00, // (NameType) + 0x01, 0x00, // (NameCount) + 0x10, 0x00, 0x02, 0x00, // (Names) + // == conformant array == + 0x01, 0x00, 0x00, 0x00, // (nitems) + + // = RPC_UNICODE_STRING = + 0x1c, 0x00, // (Length) + 0x1e, 0x00, // (MaximumLength) + 0x14, 0x00, 0x02, 0x00, /// (Buffer ptr) + // == Uni-dimensional Conformant-varying Array == + 0x0f, 0x00, 0x00, 0x00, // (maximum count) + 0x00, 0x00, 0x00, 0x00, // (offset) + 0x0e, 0x00, 0x00, 0x00, // (length) + 0x41, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00, + 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x75, 0x00, 0x72, 0x00, + 0x00, 0x00, + + 0x00, 0x00 + }; + KERB_RPC_INTERNAL_NAME intName = { 0 }; + + wStream staticS = { 0 }; + wStream* s = Stream_StaticInit(&staticS, payload3, sizeof(payload3)); + if (!ndr_read_KERB_RPC_INTERNAL_NAME(context, s, NULL, &intName) || + !ndr_treat_deferred_read(context, s)) + goto out; + ndr_destroy_KERB_RPC_INTERNAL_NAME(context, NULL, &intName); + ndr_context_reset(context); + } /* ====================================================================== */ - BYTE payload2[] = { - // ------------ a RPC_UNICODE_STRING: Administrateur ------------------------- - 0x1c, 0x00, // (Length) - 0x1e, 0x00, // (MaximumLength) - 0x1c, 0x00, 0x02, 0x00, // (Buffer ptr) - // == conformant array == - 0x0f, 0x00, 0x00, 0x00, // (maximum count) - 0x00, 0x00, 0x00, 0x00, // (offset) - 0x0e, 0x00, 0x00, 0x00, // (length) - - 0x48, 0x00, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x49, 0x00, 0x4e, - 0x00, 0x47, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x00, 0x00, - - 0x00, 0x00 - }; - retCode = -3; - - s = Stream_StaticInit(&staticS, payload2, sizeof(payload2)); - RPC_UNICODE_STRING unicode = { 0 }; - if (!ndr_read_RPC_UNICODE_STRING(context, s, NULL, &unicode) || !ndr_treat_deferred_read(context, s)) - goto out; - RPC_UNICODE_STRING_destroy(context, &unicode); - ndr_context_reset(context); - - /* ====================================================================== */ - BYTE payload3[] = { - // ------------ an KERB_RPC_INTERNAL_NAME: HARDENING3.COM ------------------------- - 0x01, 0x00, // (NameType) - 0x01, 0x00, // (NameCount) - 0x10, 0x00, 0x02, 0x00, // (Names) - // == conformant array == - 0x01, 0x00, 0x00, 0x00, // (nitems) - - // = RPC_UNICODE_STRING = - 0x1c, 0x00, // (Length) - 0x1e, 0x00, // (MaximumLength) - 0x14, 0x00, 0x02, 0x00, /// (Buffer ptr) - // == Uni-dimensional Conformant-varying Array == - 0x0f, 0x00, 0x00, 0x00, // (maximum count) - 0x00, 0x00, 0x00, 0x00, // (offset) - 0x0e, 0x00, 0x00, 0x00, // (length) - 0x41, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, - 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x75, 0x00, 0x72, 0x00, 0x00, 0x00, - - 0x00, 0x00 - }; - KERB_RPC_INTERNAL_NAME intName = { 0 }; - retCode = -4; - s = Stream_StaticInit(&staticS, payload3, sizeof(payload3)); - if (!ndr_read_KERB_RPC_INTERNAL_NAME(context, s, NULL, &intName) || !ndr_treat_deferred_read(context, s)) - goto out; - KERB_RPC_INTERNAL_NAME_destroy(context, &intName); - ndr_context_reset(context); -#endif - - /* ====================================================================== */ -#if 0 - BYTE payload4[] = { + { + retCode = -5; + const BYTE payload4[] = { 0x03, 0x01, 0x03, 0x01, // unionId / unionId 0x04, 0x00, 0x02, 0x00, // (EncryptionKey ptr) 0xf8, 0xca, 0x95, 0x11, // (SequenceNumber) @@ -251,80 +306,77 @@ static int TestNdrEarRead(int argc, char* argv[]) // === EncryptionKey === 0x40, 0xe9, 0x12, 0xdf, // reserved1 0x12, 0x00, 0x00, 0x00, // reserved2 - // KERB_RPC_OCTET_STRING - 0x4c, 0x00, 0x00, 0x00, // (length) - 0x08, 0x00, 0x02, 0x00, // (value ptr) - // == conformant array == - 0x4c, 0x00, 0x00, 0x00, // (length) - 0xc4, 0x41, 0xee, 0x34, - 0x82, 0x2b, 0x29, 0x61, 0xe2, 0x96, 0xb5, 0x75, 0x61, 0x2d, 0xbf, 0x86, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x08, 0x60, 0x2e, - 0x30, 0x3e, 0xfe, 0x56, 0x11, 0xf0, 0x31, 0xf2, 0xd6, 0x2e, 0x3d, 0x33, 0xfe, 0xce, 0x56, 0x12, - 0xbf, 0xb2, 0xe5, 0x86, 0x29, 0x8d, 0x29, 0x74, 0x1f, 0x8a, 0xf9, 0xb9, 0x8c, 0xd4, 0x86, 0x3a, - 0x21, 0x92, 0xb2, 0x07, 0x95, 0x4b, 0xea, 0xee, + // KERB_RPC_OCTET_STRING + 0x4c, 0x00, 0x00, 0x00, // (length) + 0x08, 0x00, 0x02, 0x00, // (value ptr) + // == conformant array == + 0x4c, 0x00, 0x00, 0x00, // (length) + 0xc4, 0x41, 0xee, 0x34, 0x82, 0x2b, 0x29, 0x61, 0xe2, 0x96, 0xb5, 0x75, 0x61, 0x2d, + 0xbf, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x89, 0x08, 0x60, 0x2e, 0x30, 0x3e, 0xfe, 0x56, 0x11, 0xf0, + 0x31, 0xf2, 0xd6, 0x2e, 0x3d, 0x33, 0xfe, 0xce, 0x56, 0x12, 0xbf, 0xb2, 0xe5, 0x86, + 0x29, 0x8d, 0x29, 0x74, 0x1f, 0x8a, 0xf9, 0xb9, 0x8c, 0xd4, 0x86, 0x3a, 0x21, 0x92, + 0xb2, 0x07, 0x95, 0x4b, 0xea, 0xee, //=== ClientName - KERB_RPC_INTERNAL_NAME === - 0x01, 0x00, // (NameType) - 0x01, 0x00, // (NameCount) + 0x01, 0x00, // (NameType) + 0x01, 0x00, // (NameCount) 0x10, 0x00, 0x02, 0x00, // (Names) - 0x01, 0x00, 0x00, 0x00, // (nitems) + 0x01, 0x00, 0x00, 0x00, // (nitems) - // = RPC_UNICODE_STRING = - 0x1c, 0x00, // (Length) - 0x1e, 0x00, // (MaximumLength) - 0x14, 0x00, 0x02, 0x00, //(Buffer ptr) - // == Uni-dimensional Conformant-varying Array == - 0x0f, 0x00, 0x00, 0x00, // (maximum count) - 0x00, 0x00, 0x00, 0x00, // (offset) - 0x0e, 0x00, 0x00, 0x00, // (length) - 0x41, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, - 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x75, 0x00, 0x72, 0x00, + // = RPC_UNICODE_STRING = + 0x1c, 0x00, // (Length) + 0x1e, 0x00, // (MaximumLength) + 0x14, 0x00, 0x02, 0x00, //(Buffer ptr) + // == Uni-dimensional Conformant-varying Array == + 0x0f, 0x00, 0x00, 0x00, // (maximum count) + 0x00, 0x00, 0x00, 0x00, // (offset) + 0x0e, 0x00, 0x00, 0x00, // (length) + 0x41, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00, + 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x75, 0x00, 0x72, 0x00, // === ClientRealm - RPC_UNICODE_STRING === - 0x1c, 0x00, // (Length) - 0x1e, 0x00, // (MaximumLength) + 0x1c, 0x00, // (Length) + 0x1e, 0x00, // (MaximumLength) 0x1c, 0x00, 0x02, 0x00, // (Buffer ptr) - // == Uni-dimensional conformant varying array == - 0x0f, 0x00, 0x00, 0x00, // (maximum count) - 0x00, 0x00, 0x00, 0x00, // (offset) - 0x0e, 0x00, 0x00, 0x00, // (length) - 0x48, 0x00, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x49, 0x00, 0x4e, 0x00, - 0x47, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00, + // == Uni-dimensional conformant varying array == + 0x0f, 0x00, 0x00, 0x00, // (maximum count) + 0x00, 0x00, 0x00, 0x00, // (offset) + 0x0e, 0x00, 0x00, 0x00, // (length) + 0x48, 0x00, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x49, 0x00, + 0x4e, 0x00, 0x47, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, // padding // == SkewTime == - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // === AuthData - KERB_ASN1_DATA == 0x00, 0x00, 0x00, 0x00, // (PduType) 0x02, 0x00, 0x00, 0x00, // (Length) 0x28, 0x00, 0x02, 0x00, // (Asn1Buffer) - // == conformant array == - 0x02, 0x00, 0x00, 0x00, // (nitems) - 0x30, 0x00, - 0x00, 0x00, // (padding) + // == conformant array == + 0x02, 0x00, 0x00, 0x00, // (nitems) + 0x30, 0x00, 0x00, 0x00, // (padding) // === GssChecksum - KERB_ASN1_DATA === 0x08, 0x00, 0x00, 0x00, // (PduType) 0x1b, 0x00, 0x00, 0x00, // (Length) 0x30, 0x00, 0x02, 0x00, // (Asn1Buffer) - // == conformant array == - 0x1b, 0x00, 0x00, 0x00, // (length) - 0x30, 0x19, - 0xa0, 0x03, - 0x02, 0x01, 0x07, - 0xa1, 0x12, - 0x04, 0x10, 0xb9, 0x4f, 0xcd, 0xae, 0xd9, 0xa8, 0xff, 0x49, 0x69, 0x5a, 0xd1, - 0x1d, 0x38, 0x49, 0xb6, 0x92, 0x00 - }; - size_t sizeofPayload4 = sizeof(payload4); -#endif + // == conformant array == + 0x1b, 0x00, 0x00, 0x00, // (length) + 0x30, 0x19, 0xa0, 0x03, 0x02, 0x01, 0x07, 0xa1, 0x12, 0x04, 0x10, 0xb9, 0x4f, 0xcd, + 0xae, 0xd9, 0xa8, 0xff, 0x49, 0x69, 0x5a, 0xd1, 0x1d, 0x38, 0x49, 0xb6, 0x92, 0x00 + }; + if (!run_payload(context, payload4, sizeof(payload4))) + goto out; + } - size_t sizeofPayload4 = 0; - BYTE* payload4 = parseHexBlock("03 01 03 01 \ + { + retCode = -6; + size_t sizeofPayload4 = 0; + BYTE* payload4 = parseHexBlock("03 01 03 01 \ 04 00 02 00 38 9e ef 6b 0c 00 02 00 18 00 02 00 \ 20 00 02 00 00 00 00 00 24 00 02 00 2c 00 02 00 \ 07 00 00 00 13 8a a5 a8 12 00 00 00 20 00 00 00 \ @@ -342,31 +394,16 @@ static int TestNdrEarRead(int argc, char* argv[]) 08 00 00 00 1b 00 00 00 30 00 02 00 1b 00 00 00 \ 30 19 a0 03 02 01 07 a1 12 04 10 e4 aa ff 2b 93 \ 97 4c f2 5c 0b 49 85 72 92 94 54 00", - &sizeofPayload4); - - if (!payload4) - goto out; - - CreateApReqAuthenticatorReq createApReqAuthenticatorReq = { 0 }; - s = Stream_StaticInit(&staticS, payload4, sizeofPayload4); - if (!ndr_skip_bytes(context, s, 4) || /* skip union id */ - !ndr_read_CreateApReqAuthenticatorReq(context, s, NULL, &createApReqAuthenticatorReq) || - !ndr_treat_deferred_read(context, s) || createApReqAuthenticatorReq.KeyUsage != 7 || - !createApReqAuthenticatorReq.EncryptionKey || createApReqAuthenticatorReq.SubKey || - !createApReqAuthenticatorReq.ClientName || - createApReqAuthenticatorReq.ClientName->nameHints.count != 1 || - !createApReqAuthenticatorReq.ClientRealm || !createApReqAuthenticatorReq.AuthData || - createApReqAuthenticatorReq.AuthData->Asn1BufferHints.count != 2 || - !createApReqAuthenticatorReq.SkewTime || - createApReqAuthenticatorReq.SkewTime->QuadPart != 0) - goto out; - ndr_destroy_CreateApReqAuthenticatorReq(context, NULL, &createApReqAuthenticatorReq); - ndr_context_reset(context); + &sizeofPayload4); + const BOOL rc = run_payload(context, payload4, sizeofPayload4); + free(payload4); + if (!rc) + goto out; + } /* ============ successful end of test =============== */ retCode = 0; out: - free(payload4); ndr_context_destroy(&context); return retCode; } diff --git a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c index 235d15f15..ce7346778 100644 --- a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c +++ b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c @@ -205,6 +205,8 @@ static BOOL tsmf_ffmpeg_init_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_TYP /* Add a padding to avoid invalid memory read in some codec */ mdecoder->codec_context->extradata_size = WINPR_ASSERTING_INT_CAST(int, media_type->ExtraDataSize + 8); + if (mdecoder->codec_context->extradata_size == 0) + return FALSE; mdecoder->codec_context->extradata = calloc(1, mdecoder->codec_context->extradata_size); if (!mdecoder->codec_context->extradata) diff --git a/channels/tsmf/client/tsmf_codec.c b/channels/tsmf/client/tsmf_codec.c index 9483d7d50..49b56e53c 100644 --- a/channels/tsmf/client/tsmf_codec.c +++ b/channels/tsmf/client/tsmf_codec.c @@ -489,7 +489,6 @@ static BOOL tsmf_read_format_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s, UINT3 BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s) { UINT32 cbFormat = 0; - BOOL ret = TRUE; ZeroMemory(mediatype, sizeof(TS_AM_MEDIA_TYPE)); @@ -508,7 +507,7 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s) mediatype->MajorType = tsmf_major_type_map[i].type; if (mediatype->MajorType == TSMF_MAJOR_TYPE_UNKNOWN) - ret = FALSE; + return FALSE; DEBUG_TSMF("MediaMajorType %s", tsmf_major_type_map[i].name); Stream_Seek(s, 16); @@ -527,7 +526,7 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s) mediatype->SubType = tsmf_sub_type_map[i].type; if (mediatype->SubType == TSMF_SUB_TYPE_UNKNOWN) - ret = FALSE; + return FALSE; DEBUG_TSMF("MediaSubType %s", tsmf_sub_type_map[i].name); Stream_Seek(s, 16); @@ -551,7 +550,7 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s) mediatype->FormatType = tsmf_format_type_map[i].type; if (mediatype->FormatType == TSMF_FORMAT_TYPE_UNKNOWN) - ret = FALSE; + return FALSE; DEBUG_TSMF("FormatType %s", tsmf_format_type_map[i].name); Stream_Seek(s, 16); @@ -565,7 +564,7 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s) winpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(s), cbFormat); #endif - ret = tsmf_read_format_type(mediatype, s, cbFormat); + const BOOL ret = tsmf_read_format_type(mediatype, s, cbFormat); if (mediatype->SamplesPerSecond.Numerator == 0) mediatype->SamplesPerSecond.Numerator = 1; diff --git a/channels/tsmf/client/tsmf_media.c b/channels/tsmf/client/tsmf_media.c index ff7460f0b..25abd7ed9 100644 --- a/channels/tsmf/client/tsmf_media.c +++ b/channels/tsmf/client/tsmf_media.c @@ -691,14 +691,6 @@ static BOOL tsmf_sample_playback(TSMF_SAMPLE* sample) else { UINT64 ack_anticipation_time = get_current_time(); - BOOL buffer_filled = TRUE; - - /* Classify the buffer as filled once it reaches minimum level */ - if (stream->decoder->BufferLevel) - { - if (stream->currentBufferLevel < stream->minBufferLevel) - buffer_filled = FALSE; - } ack_anticipation_time += (sample->duration / 2 < MAX_ACK_TIME) ? sample->duration / 2 : MAX_ACK_TIME; @@ -1460,13 +1452,12 @@ BOOL tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pC UINT32 sample_id, UINT64 start_time, UINT64 end_time, UINT64 duration, UINT32 extensions, UINT32 data_size, BYTE* data) { - TSMF_SAMPLE* sample = NULL; (void)SetEvent(stream->ready); if (TERMINATING) return TRUE; - sample = (TSMF_SAMPLE*)calloc(1, sizeof(TSMF_SAMPLE)); + TSMF_SAMPLE* sample = (TSMF_SAMPLE*)calloc(1, sizeof(TSMF_SAMPLE)); if (!sample) { @@ -1497,6 +1488,7 @@ BOOL tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pC if (!Queue_Enqueue(stream->sample_list, sample)) goto fail; + // NOLINTNEXTLINE(clang-analyzer-unix.Malloc): Queue_Enqueue takes ownership of sample return TRUE; fail: diff --git a/client/X11/xf_tsmf.c b/client/X11/xf_tsmf.c index ff42dcfcc..d50b251cf 100644 --- a/client/X11/xf_tsmf.c +++ b/client/X11/xf_tsmf.c @@ -44,7 +44,7 @@ static long xv_port = 0; struct xf_xv_context { - long xv_port; + XvPortID xv_port; Atom xv_colorkey_atom; int xv_image_size; int xv_shmid; diff --git a/libfreerdp/codec/dsp.c b/libfreerdp/codec/dsp.c index db1128ff6..610814251 100644 --- a/libfreerdp/codec/dsp.c +++ b/libfreerdp/codec/dsp.c @@ -344,7 +344,7 @@ static UINT16 dsp_decode_ima_adpcm_sample(ADPCM* WINPR_RESTRICT adpcm, unsigned d = 32767; adpcm->ima.last_sample[channel] = (INT16)d; - adpcm->ima.last_step[channel] += ima_step_index_table[sample]; + adpcm->ima.last_step[channel] = adpcm->ima.last_step[channel] + ima_step_index_table[sample]; if (adpcm->ima.last_step[channel] < 0) adpcm->ima.last_step[channel] = 0; @@ -795,7 +795,7 @@ static BYTE dsp_encode_ima_adpcm_sample(ADPCM* WINPR_RESTRICT adpcm, size_t chan diff = 32767; adpcm->ima.last_sample[channel] = (INT16)diff; - adpcm->ima.last_step[channel] += ima_step_index_table[enc]; + adpcm->ima.last_step[channel] = adpcm->ima.last_step[channel] + ima_step_index_table[enc]; if (adpcm->ima.last_step[channel] < 0) adpcm->ima.last_step[channel] = 0; @@ -894,7 +894,7 @@ static const INT32 ms_adpcm_coeffs2[7] = { 0, -256, 0, 64, 0, -208, -232 }; static inline INT16 freerdp_dsp_decode_ms_adpcm_sample(ADPCM* WINPR_RESTRICT adpcm, BYTE sample, size_t channel) { - const INT8 nibble = (sample & 0x08 ? (INT8)sample - 16 : (INT8)sample); + const INT8 nibble = (sample & 0x08) ? (INT8)(sample - 16) : (INT8)sample; INT32 presample = ((adpcm->ms.sample1[channel] * ms_adpcm_coeffs1[adpcm->ms.predictor[channel]]) + (adpcm->ms.sample2[channel] * ms_adpcm_coeffs2[adpcm->ms.predictor[channel]])) / diff --git a/winpr/libwinpr/sspi/test/TestNTLM.c b/winpr/libwinpr/sspi/test/TestNTLM.c index a46692245..3e68ddc4c 100644 --- a/winpr/libwinpr/sspi/test/TestNTLM.c +++ b/winpr/libwinpr/sspi/test/TestNTLM.c @@ -179,10 +179,7 @@ static int test_ntlm_client_init(TEST_NTLM_CLIENT* ntlm, const char* user, const ZeroMemory(&ntlm->inputBuffer, sizeof(SecBuffer)); ZeroMemory(&ntlm->outputBuffer, sizeof(SecBuffer)); ntlm->fContextReq = 0; -#if 0 - /* HTTP authentication flags */ - ntlm->fContextReq |= ISC_REQ_CONFIDENTIALITY; -#endif + /* NLA authentication flags */ ntlm->fContextReq |= ISC_REQ_MUTUAL_AUTH; ntlm->fContextReq |= ISC_REQ_CONFIDENTIALITY;