From 6df6332198597aa0e03f9e15c9f4e8c883356f3b Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Tue, 15 Dec 2009 09:50:40 +0100 Subject: [PATCH] msi: Reject greater than and less than string comparisons in WHERE clauses. --- dlls/msi/tests/db.c | 24 ++++++++++++++++++++++++ dlls/msi/where.c | 6 +----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index e44970d9c2e..c909f905cb6 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -1761,6 +1761,30 @@ static void test_where(void) ok( r == ERROR_SUCCESS, "query failed: %d\n", r ); MsiCloseHandle( rec ); + rec = 0; + query = "SELECT * FROM `Media` WHERE `DiskPrompt` < 'Cabinet'"; + r = do_query(hdb, query, &rec); + ok( r == ERROR_BAD_QUERY_SYNTAX, "query failed: %d\n", r ); + MsiCloseHandle( rec ); + + rec = 0; + query = "SELECT * FROM `Media` WHERE `DiskPrompt` > 'Cabinet'"; + r = do_query(hdb, query, &rec); + ok( r == ERROR_BAD_QUERY_SYNTAX, "query failed: %d\n", r ); + MsiCloseHandle( rec ); + + rec = 0; + query = "SELECT * FROM `Media` WHERE `DiskPrompt` <> 'Cabinet'"; + r = do_query(hdb, query, &rec); + todo_wine ok( r == ERROR_SUCCESS, "query failed: %d\n", r ); + MsiCloseHandle( rec ); + + rec = 0; + query = "SELECT * FROM `Media` WHERE `DiskPrompt` = 'Cabinet'"; + r = do_query(hdb, query, &rec); + ok( r == ERROR_NO_MORE_ITEMS, "query failed: %d\n", r ); + MsiCloseHandle( rec ); + rec = MsiCreateRecord(1); MsiRecordSetString(rec, 1, ""); diff --git a/dlls/msi/where.c b/dlls/msi/where.c index 32f71b9d1e0..545d6a84dc6 100644 --- a/dlls/msi/where.c +++ b/dlls/msi/where.c @@ -309,9 +309,7 @@ static UINT STRCMP_Evaluate( MSIWHEREVIEW *wv, UINT row, const struct expr *cond sr = lstrcmpW( l_str, r_str ); *val = ( cond->u.expr.op == OP_EQ && ( sr == 0 ) ) || - ( cond->u.expr.op == OP_NE && ( sr != 0 ) ) || - ( cond->u.expr.op == OP_LT && ( sr < 0 ) ) || - ( cond->u.expr.op == OP_GT && ( sr > 0 ) ); + ( cond->u.expr.op == OP_NE && ( sr != 0 ) ); return ERROR_SUCCESS; } @@ -644,8 +642,6 @@ static UINT WHERE_VerifyCondition( MSIDATABASE *db, MSIVIEW *table, struct expr switch( cond->u.expr.op ) { case OP_EQ: - case OP_GT: - case OP_LT: case OP_NE: break; default: