| 1 |
/* |
| 2 |
* Some or all of this work - Copyright (c) 2006 - 2021, Intel Corp. |
| 3 |
* All rights reserved. |
| 4 |
* |
| 5 |
* Redistribution and use in source and binary forms, with or without modification, |
| 6 |
* are permitted provided that the following conditions are met: |
| 7 |
* |
| 8 |
* Redistributions of source code must retain the above copyright notice, |
| 9 |
* this list of conditions and the following disclaimer. |
| 10 |
* Redistributions in binary form must reproduce the above copyright notice, |
| 11 |
* this list of conditions and the following disclaimer in the documentation |
| 12 |
* and/or other materials provided with the distribution. |
| 13 |
* Neither the name of Intel Corporation nor the names of its contributors |
| 14 |
* may be used to endorse or promote products derived from this software |
| 15 |
* without specific prior written permission. |
| 16 |
* |
| 17 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 21 |
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 25 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| 26 |
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 |
*/ |
| 28 |
/* |
| 29 |
* Bug 151: |
| 30 |
* |
| 31 |
* SUMMARY: The zero-length resulting String of Mid operator passed to Concatenate operator causes crash |
| 32 |
* |
| 33 |
* Check absence of crash.. |
| 34 |
*/ |
| 35 |
Method (MF3F, 1, Serialized) |
| 36 |
{ |
| 37 |
Name (B000, Buffer (Arg0){}) |
| 38 |
Name (B001, Buffer (0x07) |
| 39 |
{ |
| 40 |
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 // ....... |
| 41 |
}) |
| 42 |
Name (B002, Buffer (0x07) |
| 43 |
{ |
| 44 |
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E // ....... |
| 45 |
}) |
| 46 |
Debug = "Buffer case" |
| 47 |
Debug = B000 /* \MF3F.B000 */ |
| 48 |
Debug = SizeOf (B000) |
| 49 |
/* 1. */ |
| 50 |
|
| 51 |
Local1 = Concatenate (B000, B001) |
| 52 |
Debug = "Ok: Concatenate(<Default empty buffer>, ...)" |
| 53 |
Concatenate (B000, B001, Local0) |
| 54 |
If ((Local0 != Buffer (0x07) |
| 55 |
{ |
| 56 |
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 // ....... |
| 57 |
})) |
| 58 |
{ |
| 59 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Local0, Buffer (0x07) |
| 60 |
{ |
| 61 |
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 // ....... |
| 62 |
}) |
| 63 |
} |
| 64 |
|
| 65 |
/* 2. */ |
| 66 |
|
| 67 |
Local0 = Mid (B002, 0x07, 0x01) |
| 68 |
Debug = Local0 |
| 69 |
Debug = SizeOf (Local0) |
| 70 |
Debug = "Try: Concatenate(<Mid empty buffer result object>, ...)" |
| 71 |
Local1 = Concatenate (Local0, B001) |
| 72 |
Debug = "Ok: Concatenate(<Mid empty buffer result object>, ...)" |
| 73 |
Concatenate (Local0, B001, Local0) |
| 74 |
If ((Local0 != Buffer (0x07) |
| 75 |
{ |
| 76 |
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 // ....... |
| 77 |
})) |
| 78 |
{ |
| 79 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Local0, Buffer (0x07) |
| 80 |
{ |
| 81 |
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 // ....... |
| 82 |
}) |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
Method (MF40, 0, Serialized) |
| 87 |
{ |
| 88 |
Name (S000, "") |
| 89 |
Name (S001, "String1") |
| 90 |
Name (S002, "String2") |
| 91 |
Debug = "String case" |
| 92 |
Debug = S000 /* \MF40.S000 */ |
| 93 |
Debug = SizeOf (S000) |
| 94 |
/* 3. */ |
| 95 |
|
| 96 |
Local1 = Concatenate (S000, S001) |
| 97 |
Debug = "Ok: Concatenate(<Default empty string>, ...)" |
| 98 |
Concatenate (S000, S001, Local0) |
| 99 |
If ((Local0 != "String1")) |
| 100 |
{ |
| 101 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Local0, "String1") |
| 102 |
} |
| 103 |
|
| 104 |
/* 4. */ |
| 105 |
|
| 106 |
Local0 = Mid (S002, 0x07, 0x01) |
| 107 |
Debug = Local0 |
| 108 |
Debug = SizeOf (Local0) |
| 109 |
Debug = "Try: Concatenate(<Mid empty string result object>, ...)" |
| 110 |
Local1 = Concatenate (Local0, S001) |
| 111 |
Debug = "Ok: Concatenate(<Mid empty string result object>, ...)" |
| 112 |
Concatenate (Local0, S001, Local0) |
| 113 |
If ((Local0 != "String1")) |
| 114 |
{ |
| 115 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Local0, "String1") |
| 116 |
} |
| 117 |
} |
| 118 |
|
| 119 |
Method (MF41, 0, NotSerialized) |
| 120 |
{ |
| 121 |
MF3F (0x00) |
| 122 |
MF40 () |
| 123 |
} |