diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:25:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:25:37 +0000 |
commit | 3c206f96fd1e102a13b2971778060fef4be7afbc (patch) | |
tree | 26d54f12b25a491844130c7934c60d97c85807b7 /libfreerdp/codec/nsc.c | |
parent | Releasing progress-linux version 3.5.0+dfsg1-1~progress7.99u1. (diff) | |
download | freerdp3-3c206f96fd1e102a13b2971778060fef4be7afbc.tar.xz freerdp3-3c206f96fd1e102a13b2971778060fef4be7afbc.zip |
Merging upstream version 3.5.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libfreerdp/codec/nsc.c')
-rw-r--r-- | libfreerdp/codec/nsc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libfreerdp/codec/nsc.c b/libfreerdp/codec/nsc.c index 74f4e28..d1b594b 100644 --- a/libfreerdp/codec/nsc.c +++ b/libfreerdp/codec/nsc.c @@ -86,8 +86,8 @@ static BOOL nsc_decode(NSC_CONTEXT* context) for (UINT32 x = 0; x < context->width; x++) { INT16 y_val = (INT16)*yplane; - INT16 co_val = (INT16)(INT8)(*coplane << shift); - INT16 cg_val = (INT16)(INT8)(*cgplane << shift); + INT16 co_val = (INT16)(INT8)(((INT16)*coplane) << shift); + INT16 cg_val = (INT16)(INT8)(((INT16)*cgplane) << shift); INT16 r_val = y_val + co_val - cg_val; INT16 g_val = y_val + cg_val; INT16 b_val = y_val - co_val - cg_val; @@ -250,6 +250,13 @@ static BOOL nsc_stream_initialize(NSC_CONTEXT* context, wStream* s) } Stream_Read_UINT8(s, context->ColorLossLevel); /* ColorLossLevel (1 byte) */ + if ((context->ColorLossLevel < 1) || (context->ColorLossLevel > 7)) + { + WLog_Print(context->priv->log, WLOG_ERROR, + "ColorLossLevel=%" PRIu8 " out of range, must be [1,7] inclusive", + context->ColorLossLevel); + return FALSE; + } Stream_Read_UINT8(s, context->ChromaSubsamplingLevel); /* ChromaSubsamplingLevel (1 byte) */ Stream_Seek(s, 2); /* Reserved (2 bytes) */ context->Planes = Stream_Pointer(s); @@ -363,7 +370,10 @@ NSC_CONTEXT* nsc_context_new(void) NSC_INIT_SIMD(context); return context; error: + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC nsc_context_free(context); + WINPR_PRAGMA_DIAG_POP return NULL; } |