From b2e3542666bc5535776a361d8dfe8c8246f01adf Mon Sep 17 00:00:00 2001 From: Samer El-Haj-Mahmoud Date: Wed, 16 Dec 2015 02:46:53 +0000 Subject: [PATCH] MdeModulePkg: Fix RegularExpressionDxe memcpy intrinsic. Use explicit CopyMem to resolve intrinsic memcpy errors on some compilers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Samer El-Haj-Mahmoud Reviewed-by: Qiu Shumin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19292 6f19259b-4bc3-4df7-8a09-765794883524 --- .../RegularExpressionDxe/Oniguruma/regcomp.c | 14 ++++++++------ .../RegularExpressionDxe/Oniguruma/regparse.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regcomp.c b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regcomp.c index 891dd3a9e8..088450f1e4 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regcomp.c +++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regcomp.c @@ -70,7 +70,9 @@ static void swap_node(Node* a, Node* b) { Node c; - c = *a; *a = *b; *b = c; + CopyMem (&c, a, sizeof (Node)); + CopyMem (a, b, sizeof (Node)); + CopyMem (b, &c, sizeof (Node)); if (NTYPE(a) == NT_STR) { StrNode* sn = NSTR(a); @@ -4113,7 +4115,7 @@ alt_merge_mml(MinMaxLen* to, MinMaxLen* from) static void copy_opt_env(OptEnv* to, OptEnv* from) { - *to = *from; + CopyMem (to, from, sizeof (OptEnv)); } static void @@ -4126,7 +4128,7 @@ clear_opt_anc_info(OptAncInfo* anc) static void copy_opt_anc_info(OptAncInfo* to, OptAncInfo* from) { - *to = *from; + CopyMem (to, from, sizeof (OptAncInfo)); } static void @@ -4210,7 +4212,7 @@ clear_opt_exact_info(OptExactInfo* ex) static void copy_opt_exact_info(OptExactInfo* to, OptExactInfo* from) { - *to = *from; + CopyMem (to, from, sizeof (OptExactInfo)); } static void @@ -4358,7 +4360,7 @@ clear_opt_map_info(OptMapInfo* map) static void copy_opt_map_info(OptMapInfo* to, OptMapInfo* from) { - *to = *from; + CopyMem (to, from, sizeof (OptMapInfo)); } static void @@ -4473,7 +4475,7 @@ clear_node_opt_info(NodeOptInfo* opt) static void copy_node_opt_info(NodeOptInfo* to, NodeOptInfo* from) { - *to = *from; + CopyMem (to, from, sizeof (NodeOptInfo)); } static void diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c index b0fee98a16..a87fbfc426 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c +++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c @@ -2217,7 +2217,7 @@ onig_reduce_nested_quantifier(Node* pnode, Node* cnode) switch(ReduceTypeTable[cnum][pnum]) { case RQ_DEL: - *pnode = *cnode; + CopyMem (pnode, cnode, sizeof (Node)); break; case RQ_A: p->target = c->target;