Changeset 389
- Timestamp:
- 02/19/10 04:13:07 (7 months ago)
- Files:
-
- branches/dmd-1.x/src/e2ir.c (modified) (1 diff)
- branches/dmd-1.x/src/expression.c (modified) (1 diff)
- trunk/src/e2ir.c (modified) (2 diffs)
- trunk/src/expression.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/e2ir.c
r266 r389 2025 2025 #endif 2026 2026 e = el_bin(OPcall, TYint, el_var(rtlsym[rtlfunc]), ep); 2027 2027 if (op == TOKnotequal) 2028 2028 e = el_bin(OPxor, TYint, e, el_long(TYint, 1)); 2029 2029 el_setLoc(e,loc); 2030 } 2031 else if (t1->ty == Taarray && t2->ty == Taarray) 2032 { TypeAArray *taa = (TypeAArray *)t1; 2033 Symbol *s = taa->aaGetSymbol("Equal", 0); 2034 elem *ti = taa->getTypeInfo(NULL)->toElem(irs); 2035 elem *ea1 = e1->toElem(irs); 2036 elem *ea2 = e2->toElem(irs); 2037 // aaEqual(ti, e1, e2) 2038 elem *ep = el_params(ea2, ea1, ti, NULL); 2039 e = el_bin(OPcall, TYnptr, el_var(s), ep); 2040 if (op == TOKnotequal) 2041 e = el_bin(OPxor, TYint, e, el_long(TYint, 1)); 2042 el_setLoc(e,loc); 2043 return e; 2030 2044 } 2031 2045 else 2032 2046 e = toElemBin(irs, eop); 2033 2047 return e; 2034 2048 } branches/dmd-1.x/src/expression.c
r382 r389 5255 5255 name = (char *)se->string; 5256 5256 5257 5257 if (!global.params.fileImppath) 5258 5258 { error("need -Jpath switch to import text file %s", name); 5259 5259 goto Lerror; 5260 } 5261 5262 /* Be wary of CWE-22: Improper Limitation of a Pathname to a Restricted Directory 5263 * ('Path Traversal') attacks. 5264 * http://cwe.mitre.org/data/definitions/22.html 5265 */ 5266 5267 /* Do harsh sanitizing by limiting the name's character set. 5268 */ 5269 for (const char *p = name; *p; p++) 5270 { 5271 if (!(isalnum(*p) || *p == '.' || *p == '_')) 5272 { 5273 error("file name characters are restricted to [a-zA-Z0-9._] not '%c'", *p); 5274 goto Lerror; 5275 } 5260 5276 } 5261 5277 5262 5278 if (name != FileName::name(name)) 5263 5279 { error("use -Jpath switch to provide path for filename %s", name); 5264 5280 goto Lerror; trunk/src/e2ir.c
r368 r389 1 1 2 2 // Compiler implementation of the D programming language 3 // Copyright (c) 1999-20 09by Digital Mars3 // Copyright (c) 1999-2010 by Digital Mars 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 2310 2310 #endif 2311 2311 e = el_bin(OPcall, TYint, el_var(rtlsym[rtlfunc]), ep); 2312 2312 if (op == TOKnotequal) 2313 2313 e = el_bin(OPxor, TYint, e, el_long(TYint, 1)); 2314 2314 el_setLoc(e,loc); 2315 } 2316 else if (t1->ty == Taarray && t2->ty == Taarray) 2317 { TypeAArray *taa = (TypeAArray *)t1; 2318 Symbol *s = taa->aaGetSymbol("Equal", 0); 2319 elem *ti = taa->getTypeInfo(NULL)->toElem(irs); 2320 elem *ea1 = e1->toElem(irs); 2321 elem *ea2 = e2->toElem(irs); 2322 // aaEqual(ti, e1, e2) 2323 elem *ep = el_params(ea2, ea1, ti, NULL); 2324 e = el_bin(OPcall, TYnptr, el_var(s), ep); 2325 if (op == TOKnotequal) 2326 e = el_bin(OPxor, TYint, e, el_long(TYint, 1)); 2327 el_setLoc(e,loc); 2328 return e; 2315 2329 } 2316 2330 else 2317 2331 e = toElemBin(irs, eop); 2318 2332 return e; 2319 2333 } trunk/src/expression.c
r382 r389 5599 5599 if (!global.params.fileImppath) 5600 5600 { error("need -Jpath switch to import text file %s", name); 5601 5601 goto Lerror; 5602 5602 } 5603 5603 5604 /* Be wary of CWE-22: Improper Limitation of a Pathname to a Restricted Directory 5605 * ('Path Traversal') attacks. 5606 * http://cwe.mitre.org/data/definitions/22.html 5607 */ 5608 5609 /* Do harsh sanitizing by limiting the name's character set. 5610 */ 5611 for (const char *p = name; *p; p++) 5612 { 5613 if (!(isalnum(*p) || *p == '.' || *p == '_')) 5614 { 5615 error("file name characters are restricted to [a-zA-Z0-9._] not '%c'", *p); 5616 goto Lerror; 5617 } 5618 } 5619 5604 5620 if (name != FileName::name(name)) 5605 5621 { error("use -Jpath switch to provide path for filename %s", name); 5606 5622 goto Lerror; 5607 5623 } 5608 5624
