mirror of
https://github.com/github/codeql.git
synced 2026-04-24 00:05:14 +02:00
C++: Add failing tests with 'CAtlArray'.
This commit is contained in:
@@ -166,3 +166,86 @@ void test_CA2WEX() {
|
||||
sink(a.m_psz); // $ ir
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct CElementTraitsBase {
|
||||
typedef const T& INARGTYPE;
|
||||
typedef T& OUTARGTYPE;
|
||||
|
||||
static void CopyElements(T* pDest, const T* pSrc, size_t nElements);
|
||||
static void RelocateElements(T* pDest, T* pSrc, size_t nElements);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct CDefaultElementTraits : public CElementTraitsBase<T> {};
|
||||
|
||||
template<typename T>
|
||||
struct CElementTraits : public CDefaultElementTraits<T> {};
|
||||
|
||||
template<typename E, class ETraits = CElementTraits<E>>
|
||||
struct CAtlArray {
|
||||
using INARGTYPE = typename ETraits::INARGTYPE;
|
||||
using OUTARGTYPE = typename ETraits::OUTARGTYPE;
|
||||
|
||||
CAtlArray() throw();
|
||||
~CAtlArray() throw();
|
||||
|
||||
size_t Add(INARGTYPE element);
|
||||
size_t Add();
|
||||
size_t Append(const CAtlArray<E, ETraits>& aSrc);
|
||||
void Copy(const CAtlArray<E, ETraits>& aSrc);
|
||||
const E& GetAt(size_t iElement) const throw();
|
||||
E& GetAt(size_t iElement) throw();
|
||||
size_t GetCount() const throw();
|
||||
E* GetData() throw();
|
||||
const E* GetData() const throw();
|
||||
void InsertArrayAt(size_t iStart, const CAtlArray<E, ETraits>* paNew);
|
||||
void InsertAt(size_t iElement, INARGTYPE element, size_t nCount);
|
||||
bool IsEmpty() const throw();
|
||||
void RemoveAll() throw();
|
||||
void RemoveAt(size_t iElement, size_t nCount);
|
||||
void SetAt(size_t iElement, INARGTYPE element);
|
||||
void SetAtGrow(size_t iElement, INARGTYPE element);
|
||||
bool SetCount(size_t nNewSize, int nGrowBy);
|
||||
E& operator[](size_t ielement) throw();
|
||||
const E& operator[](size_t ielement) const throw();
|
||||
};
|
||||
|
||||
void test_CAtlArray() {
|
||||
int x = source<int>();
|
||||
|
||||
{
|
||||
CAtlArray<int> a;
|
||||
a.Add(x);
|
||||
sink(a[0]); // $ MISSING: ir
|
||||
a.Add(0);
|
||||
sink(a[0]); // $ MISSING: ir
|
||||
|
||||
CAtlArray<int> a2;
|
||||
sink(a2[0]);
|
||||
a2.Append(a);
|
||||
sink(a2[0]); // $ MISSING: ir
|
||||
|
||||
CAtlArray<int> a3;
|
||||
sink(a3[0]);
|
||||
a3.Copy(a2);
|
||||
sink(a3[0]); // $ MISSING: ir
|
||||
|
||||
sink(a3.GetAt(0)); // $ MISSING: ir
|
||||
sink(*a3.GetData()); // $ MISSING: ir
|
||||
|
||||
CAtlArray<int> a4;
|
||||
sink(a4.GetAt(0));
|
||||
a4.InsertArrayAt(0, &a3);
|
||||
sink(a4.GetAt(0)); // $ MISSING: ir
|
||||
}
|
||||
{
|
||||
CAtlArray<int> a5;
|
||||
a5.InsertAt(0, source<int>(), 1);
|
||||
sink(a5[0]); // $ MISSING: ir
|
||||
|
||||
CAtlArray<int> a6;
|
||||
a6.SetAtGrow(0, source<int>());
|
||||
sink(a6[0]); // $ MISSING: ir
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +147,151 @@ WARNING: module 'TaintTracking' has been deprecated and may be removed in future
|
||||
| atl.cpp:82:17:82:43 | call to indirect_source | atl.cpp:83:21:83:21 | y | |
|
||||
| atl.cpp:83:21:83:21 | y | atl.cpp:83:21:83:22 | call to _U_STRINGorID | TAINT |
|
||||
| atl.cpp:83:21:83:22 | call to _U_STRINGorID | atl.cpp:84:10:84:10 | u | |
|
||||
| atl.cpp:103:15:103:35 | call to indirect_source | atl.cpp:104:19:104:19 | x | |
|
||||
| atl.cpp:104:19:104:19 | x | atl.cpp:104:19:104:20 | call to CA2AEX | TAINT |
|
||||
| atl.cpp:104:19:104:20 | call to CA2AEX | atl.cpp:105:29:105:29 | a | |
|
||||
| atl.cpp:104:19:104:20 | call to CA2AEX | atl.cpp:106:10:106:10 | a | |
|
||||
| atl.cpp:104:19:104:20 | call to CA2AEX | atl.cpp:107:10:107:10 | a | |
|
||||
| atl.cpp:104:19:104:20 | call to CA2AEX | atl.cpp:108:3:108:3 | a | |
|
||||
| atl.cpp:105:29:105:29 | ref arg a | atl.cpp:106:10:106:10 | a | |
|
||||
| atl.cpp:105:29:105:29 | ref arg a | atl.cpp:107:10:107:10 | a | |
|
||||
| atl.cpp:105:29:105:29 | ref arg a | atl.cpp:108:3:108:3 | a | |
|
||||
| atl.cpp:106:10:106:10 | a [post update] | atl.cpp:107:10:107:10 | a | |
|
||||
| atl.cpp:106:10:106:10 | a [post update] | atl.cpp:108:3:108:3 | a | |
|
||||
| atl.cpp:107:10:107:10 | a [post update] | atl.cpp:108:3:108:3 | a | |
|
||||
| atl.cpp:111:15:111:35 | call to indirect_source | atl.cpp:112:19:112:19 | x | |
|
||||
| atl.cpp:112:19:112:23 | call to CA2AEX | atl.cpp:113:29:113:29 | a | |
|
||||
| atl.cpp:112:19:112:23 | call to CA2AEX | atl.cpp:114:10:114:10 | a | |
|
||||
| atl.cpp:112:19:112:23 | call to CA2AEX | atl.cpp:115:10:115:10 | a | |
|
||||
| atl.cpp:112:19:112:23 | call to CA2AEX | atl.cpp:116:3:116:3 | a | |
|
||||
| atl.cpp:113:29:113:29 | ref arg a | atl.cpp:114:10:114:10 | a | |
|
||||
| atl.cpp:113:29:113:29 | ref arg a | atl.cpp:115:10:115:10 | a | |
|
||||
| atl.cpp:113:29:113:29 | ref arg a | atl.cpp:116:3:116:3 | a | |
|
||||
| atl.cpp:114:10:114:10 | a [post update] | atl.cpp:115:10:115:10 | a | |
|
||||
| atl.cpp:114:10:114:10 | a [post update] | atl.cpp:116:3:116:3 | a | |
|
||||
| atl.cpp:115:10:115:10 | a [post update] | atl.cpp:116:3:116:3 | a | |
|
||||
| atl.cpp:129:14:129:34 | call to indirect_source | atl.cpp:131:20:131:20 | x | |
|
||||
| atl.cpp:129:14:129:34 | call to indirect_source | atl.cpp:137:20:137:20 | x | |
|
||||
| atl.cpp:131:20:131:20 | x | atl.cpp:131:20:131:21 | call to CA2CAEX | TAINT |
|
||||
| atl.cpp:131:20:131:21 | call to CA2CAEX | atl.cpp:132:30:132:30 | a | |
|
||||
| atl.cpp:131:20:131:21 | call to CA2CAEX | atl.cpp:133:10:133:10 | a | |
|
||||
| atl.cpp:131:20:131:21 | call to CA2CAEX | atl.cpp:134:10:134:10 | a | |
|
||||
| atl.cpp:131:20:131:21 | call to CA2CAEX | atl.cpp:135:3:135:3 | a | |
|
||||
| atl.cpp:137:20:137:24 | call to CA2CAEX | atl.cpp:138:30:138:30 | a | |
|
||||
| atl.cpp:137:20:137:24 | call to CA2CAEX | atl.cpp:139:10:139:10 | a | |
|
||||
| atl.cpp:137:20:137:24 | call to CA2CAEX | atl.cpp:140:10:140:10 | a | |
|
||||
| atl.cpp:137:20:137:24 | call to CA2CAEX | atl.cpp:141:3:141:3 | a | |
|
||||
| atl.cpp:155:14:155:34 | call to indirect_source | atl.cpp:157:19:157:19 | x | |
|
||||
| atl.cpp:155:14:155:34 | call to indirect_source | atl.cpp:163:19:163:19 | x | |
|
||||
| atl.cpp:157:19:157:19 | x | atl.cpp:157:19:157:20 | call to CA2WEX | TAINT |
|
||||
| atl.cpp:157:19:157:20 | call to CA2WEX | atl.cpp:158:30:158:30 | a | |
|
||||
| atl.cpp:157:19:157:20 | call to CA2WEX | atl.cpp:159:10:159:10 | a | |
|
||||
| atl.cpp:157:19:157:20 | call to CA2WEX | atl.cpp:160:10:160:10 | a | |
|
||||
| atl.cpp:157:19:157:20 | call to CA2WEX | atl.cpp:161:3:161:3 | a | |
|
||||
| atl.cpp:158:30:158:30 | ref arg a | atl.cpp:159:10:159:10 | a | |
|
||||
| atl.cpp:158:30:158:30 | ref arg a | atl.cpp:160:10:160:10 | a | |
|
||||
| atl.cpp:158:30:158:30 | ref arg a | atl.cpp:161:3:161:3 | a | |
|
||||
| atl.cpp:159:10:159:10 | a [post update] | atl.cpp:160:10:160:10 | a | |
|
||||
| atl.cpp:159:10:159:10 | a [post update] | atl.cpp:161:3:161:3 | a | |
|
||||
| atl.cpp:159:12:159:16 | ref arg m_psz | atl.cpp:160:12:160:16 | m_psz | |
|
||||
| atl.cpp:160:10:160:10 | a [post update] | atl.cpp:161:3:161:3 | a | |
|
||||
| atl.cpp:163:19:163:23 | call to CA2WEX | atl.cpp:164:30:164:30 | a | |
|
||||
| atl.cpp:163:19:163:23 | call to CA2WEX | atl.cpp:165:10:165:10 | a | |
|
||||
| atl.cpp:163:19:163:23 | call to CA2WEX | atl.cpp:166:10:166:10 | a | |
|
||||
| atl.cpp:163:19:163:23 | call to CA2WEX | atl.cpp:167:3:167:3 | a | |
|
||||
| atl.cpp:164:30:164:30 | ref arg a | atl.cpp:165:10:165:10 | a | |
|
||||
| atl.cpp:164:30:164:30 | ref arg a | atl.cpp:166:10:166:10 | a | |
|
||||
| atl.cpp:164:30:164:30 | ref arg a | atl.cpp:167:3:167:3 | a | |
|
||||
| atl.cpp:165:10:165:10 | a [post update] | atl.cpp:166:10:166:10 | a | |
|
||||
| atl.cpp:165:10:165:10 | a [post update] | atl.cpp:167:3:167:3 | a | |
|
||||
| atl.cpp:165:12:165:16 | ref arg m_psz | atl.cpp:166:12:166:16 | m_psz | |
|
||||
| atl.cpp:166:10:166:10 | a [post update] | atl.cpp:167:3:167:3 | a | |
|
||||
| atl.cpp:215:11:215:21 | call to source | atl.cpp:219:11:219:11 | x | |
|
||||
| atl.cpp:218:20:218:20 | call to CAtlArray | atl.cpp:219:5:219:5 | a | |
|
||||
| atl.cpp:218:20:218:20 | call to CAtlArray | atl.cpp:220:10:220:10 | a | |
|
||||
| atl.cpp:218:20:218:20 | call to CAtlArray | atl.cpp:221:5:221:5 | a | |
|
||||
| atl.cpp:218:20:218:20 | call to CAtlArray | atl.cpp:222:10:222:10 | a | |
|
||||
| atl.cpp:218:20:218:20 | call to CAtlArray | atl.cpp:226:15:226:15 | a | |
|
||||
| atl.cpp:218:20:218:20 | call to CAtlArray | atl.cpp:241:3:241:3 | a | |
|
||||
| atl.cpp:219:5:219:5 | ref arg a | atl.cpp:220:10:220:10 | a | |
|
||||
| atl.cpp:219:5:219:5 | ref arg a | atl.cpp:221:5:221:5 | a | |
|
||||
| atl.cpp:219:5:219:5 | ref arg a | atl.cpp:222:10:222:10 | a | |
|
||||
| atl.cpp:219:5:219:5 | ref arg a | atl.cpp:226:15:226:15 | a | |
|
||||
| atl.cpp:219:5:219:5 | ref arg a | atl.cpp:241:3:241:3 | a | |
|
||||
| atl.cpp:220:10:220:10 | ref arg a | atl.cpp:221:5:221:5 | a | |
|
||||
| atl.cpp:220:10:220:10 | ref arg a | atl.cpp:222:10:222:10 | a | |
|
||||
| atl.cpp:220:10:220:10 | ref arg a | atl.cpp:226:15:226:15 | a | |
|
||||
| atl.cpp:220:10:220:10 | ref arg a | atl.cpp:241:3:241:3 | a | |
|
||||
| atl.cpp:221:5:221:5 | ref arg a | atl.cpp:222:10:222:10 | a | |
|
||||
| atl.cpp:221:5:221:5 | ref arg a | atl.cpp:226:15:226:15 | a | |
|
||||
| atl.cpp:221:5:221:5 | ref arg a | atl.cpp:241:3:241:3 | a | |
|
||||
| atl.cpp:222:10:222:10 | ref arg a | atl.cpp:226:15:226:15 | a | |
|
||||
| atl.cpp:222:10:222:10 | ref arg a | atl.cpp:241:3:241:3 | a | |
|
||||
| atl.cpp:224:20:224:21 | call to CAtlArray | atl.cpp:225:10:225:11 | a2 | |
|
||||
| atl.cpp:224:20:224:21 | call to CAtlArray | atl.cpp:226:5:226:6 | a2 | |
|
||||
| atl.cpp:224:20:224:21 | call to CAtlArray | atl.cpp:227:10:227:11 | a2 | |
|
||||
| atl.cpp:224:20:224:21 | call to CAtlArray | atl.cpp:231:13:231:14 | a2 | |
|
||||
| atl.cpp:224:20:224:21 | call to CAtlArray | atl.cpp:241:3:241:3 | a2 | |
|
||||
| atl.cpp:225:10:225:11 | ref arg a2 | atl.cpp:226:5:226:6 | a2 | |
|
||||
| atl.cpp:225:10:225:11 | ref arg a2 | atl.cpp:227:10:227:11 | a2 | |
|
||||
| atl.cpp:225:10:225:11 | ref arg a2 | atl.cpp:231:13:231:14 | a2 | |
|
||||
| atl.cpp:225:10:225:11 | ref arg a2 | atl.cpp:241:3:241:3 | a2 | |
|
||||
| atl.cpp:226:5:226:6 | ref arg a2 | atl.cpp:227:10:227:11 | a2 | |
|
||||
| atl.cpp:226:5:226:6 | ref arg a2 | atl.cpp:231:13:231:14 | a2 | |
|
||||
| atl.cpp:226:5:226:6 | ref arg a2 | atl.cpp:241:3:241:3 | a2 | |
|
||||
| atl.cpp:227:10:227:11 | ref arg a2 | atl.cpp:231:13:231:14 | a2 | |
|
||||
| atl.cpp:227:10:227:11 | ref arg a2 | atl.cpp:241:3:241:3 | a2 | |
|
||||
| atl.cpp:229:20:229:21 | call to CAtlArray | atl.cpp:230:10:230:11 | a3 | |
|
||||
| atl.cpp:229:20:229:21 | call to CAtlArray | atl.cpp:231:5:231:6 | a3 | |
|
||||
| atl.cpp:229:20:229:21 | call to CAtlArray | atl.cpp:232:10:232:11 | a3 | |
|
||||
| atl.cpp:229:20:229:21 | call to CAtlArray | atl.cpp:234:10:234:11 | a3 | |
|
||||
| atl.cpp:229:20:229:21 | call to CAtlArray | atl.cpp:235:11:235:12 | a3 | |
|
||||
| atl.cpp:229:20:229:21 | call to CAtlArray | atl.cpp:239:26:239:27 | a3 | |
|
||||
| atl.cpp:229:20:229:21 | call to CAtlArray | atl.cpp:241:3:241:3 | a3 | |
|
||||
| atl.cpp:230:10:230:11 | ref arg a3 | atl.cpp:231:5:231:6 | a3 | |
|
||||
| atl.cpp:230:10:230:11 | ref arg a3 | atl.cpp:232:10:232:11 | a3 | |
|
||||
| atl.cpp:230:10:230:11 | ref arg a3 | atl.cpp:234:10:234:11 | a3 | |
|
||||
| atl.cpp:230:10:230:11 | ref arg a3 | atl.cpp:235:11:235:12 | a3 | |
|
||||
| atl.cpp:230:10:230:11 | ref arg a3 | atl.cpp:239:26:239:27 | a3 | |
|
||||
| atl.cpp:230:10:230:11 | ref arg a3 | atl.cpp:241:3:241:3 | a3 | |
|
||||
| atl.cpp:231:5:231:6 | ref arg a3 | atl.cpp:232:10:232:11 | a3 | |
|
||||
| atl.cpp:231:5:231:6 | ref arg a3 | atl.cpp:234:10:234:11 | a3 | |
|
||||
| atl.cpp:231:5:231:6 | ref arg a3 | atl.cpp:235:11:235:12 | a3 | |
|
||||
| atl.cpp:231:5:231:6 | ref arg a3 | atl.cpp:239:26:239:27 | a3 | |
|
||||
| atl.cpp:231:5:231:6 | ref arg a3 | atl.cpp:241:3:241:3 | a3 | |
|
||||
| atl.cpp:232:10:232:11 | ref arg a3 | atl.cpp:234:10:234:11 | a3 | |
|
||||
| atl.cpp:232:10:232:11 | ref arg a3 | atl.cpp:235:11:235:12 | a3 | |
|
||||
| atl.cpp:232:10:232:11 | ref arg a3 | atl.cpp:239:26:239:27 | a3 | |
|
||||
| atl.cpp:232:10:232:11 | ref arg a3 | atl.cpp:241:3:241:3 | a3 | |
|
||||
| atl.cpp:234:10:234:11 | ref arg a3 | atl.cpp:235:11:235:12 | a3 | |
|
||||
| atl.cpp:234:10:234:11 | ref arg a3 | atl.cpp:239:26:239:27 | a3 | |
|
||||
| atl.cpp:234:10:234:11 | ref arg a3 | atl.cpp:241:3:241:3 | a3 | |
|
||||
| atl.cpp:235:11:235:12 | ref arg a3 | atl.cpp:239:26:239:27 | a3 | |
|
||||
| atl.cpp:235:11:235:12 | ref arg a3 | atl.cpp:241:3:241:3 | a3 | |
|
||||
| atl.cpp:235:14:235:20 | call to GetData | atl.cpp:235:10:235:22 | * ... | TAINT |
|
||||
| atl.cpp:237:20:237:21 | call to CAtlArray | atl.cpp:238:10:238:11 | a4 | |
|
||||
| atl.cpp:237:20:237:21 | call to CAtlArray | atl.cpp:239:5:239:6 | a4 | |
|
||||
| atl.cpp:237:20:237:21 | call to CAtlArray | atl.cpp:240:10:240:11 | a4 | |
|
||||
| atl.cpp:237:20:237:21 | call to CAtlArray | atl.cpp:241:3:241:3 | a4 | |
|
||||
| atl.cpp:238:10:238:11 | ref arg a4 | atl.cpp:239:5:239:6 | a4 | |
|
||||
| atl.cpp:238:10:238:11 | ref arg a4 | atl.cpp:240:10:240:11 | a4 | |
|
||||
| atl.cpp:238:10:238:11 | ref arg a4 | atl.cpp:241:3:241:3 | a4 | |
|
||||
| atl.cpp:239:5:239:6 | ref arg a4 | atl.cpp:240:10:240:11 | a4 | |
|
||||
| atl.cpp:239:5:239:6 | ref arg a4 | atl.cpp:241:3:241:3 | a4 | |
|
||||
| atl.cpp:239:26:239:27 | a3 | atl.cpp:239:25:239:27 | & ... | |
|
||||
| atl.cpp:240:10:240:11 | ref arg a4 | atl.cpp:241:3:241:3 | a4 | |
|
||||
| atl.cpp:243:20:243:21 | call to CAtlArray | atl.cpp:244:5:244:6 | a5 | |
|
||||
| atl.cpp:243:20:243:21 | call to CAtlArray | atl.cpp:245:10:245:11 | a5 | |
|
||||
| atl.cpp:243:20:243:21 | call to CAtlArray | atl.cpp:250:3:250:3 | a5 | |
|
||||
| atl.cpp:244:5:244:6 | ref arg a5 | atl.cpp:245:10:245:11 | a5 | |
|
||||
| atl.cpp:244:5:244:6 | ref arg a5 | atl.cpp:250:3:250:3 | a5 | |
|
||||
| atl.cpp:245:10:245:11 | ref arg a5 | atl.cpp:250:3:250:3 | a5 | |
|
||||
| atl.cpp:247:20:247:21 | call to CAtlArray | atl.cpp:248:5:248:6 | a6 | |
|
||||
| atl.cpp:247:20:247:21 | call to CAtlArray | atl.cpp:249:10:249:11 | a6 | |
|
||||
| atl.cpp:247:20:247:21 | call to CAtlArray | atl.cpp:250:3:250:3 | a6 | |
|
||||
| atl.cpp:248:5:248:6 | ref arg a6 | atl.cpp:249:10:249:11 | a6 | |
|
||||
| atl.cpp:248:5:248:6 | ref arg a6 | atl.cpp:250:3:250:3 | a6 | |
|
||||
| atl.cpp:249:10:249:11 | ref arg a6 | atl.cpp:250:3:250:3 | a6 | |
|
||||
| bsd.cpp:17:11:17:16 | call to source | bsd.cpp:20:18:20:18 | s | |
|
||||
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:20:22:20:25 | addr | |
|
||||
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:23:8:23:11 | addr | |
|
||||
|
||||
Reference in New Issue
Block a user