forked from MarseyWorld/MarseyWorld
Snakes
9eab252e5b
Consider the case of the current /notifications filter condition: WHERE ... NOT ((comments.sentto = 2) AND (users.is_muted)) SELECT 1 WHERE NOT ((null = 2) AND (true)); ⇒ 0 rows SELECT 1 WHERE NOT ((1 = 2) AND (true)); ⇒ 1 row SELECT 1 WHERE NOT ((2 = 2) AND (true)); ⇒ 0 rows We want the first expression, where comments.sentto = null, to evaluate to false, not to null, so it negates to true. Behavior as written is: SELECT 1 WHERE NOT ((null = 2) AND (true)); → SELECT 1 WHERE NOT (null AND true); → SELECT 1 WHERE NOT null; → SELECT 1 WHERE null; Which guarantees a null return set. If we check first for non-nullity: SELECT 1 WHERE NOT ((null IS NOT null) AND (null = 2) AND (true)); ⇒ 1 SELECT 1 WHERE NOT ((1 IS NOT null) AND (1 = 2) AND (true)); ⇒ 1 SELECT 1 WHERE NOT ((2 IS NOT null) AND (2 = 2) AND (true)); ⇒ 0 |
||
---|---|---|
.. | ||
__init__.py | ||
alts.py | ||
award.py | ||
badges.py | ||
casino_game.py | ||
clients.py | ||
comment.py | ||
domains.py | ||
exiles.py | ||
flags.py | ||
follows.py | ||
hats.py | ||
leaderboard.py | ||
lottery.py | ||
marsey.py | ||
media.py | ||
mod.py | ||
mod_logs.py | ||
notifications.py | ||
polls.py | ||
saves.py | ||
streamers.py | ||
sub.py | ||
sub_logs.py | ||
sub_relationship.py | ||
submission.py | ||
subscriptions.py | ||
transactions.py | ||
user.py | ||
userblock.py | ||
views.py | ||
votes.py |