aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/sqlite-tests.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-12-14 09:29:06 +0100
committerLars Ingebrigtsen2021-12-14 09:29:13 +0100
commit8c0f9be0d1ace6437d4c604b9af79b7b0006dec4 (patch)
treeb664ec843fc4c1f420812023edd9eaa160e312a2 /test/src/sqlite-tests.el
parentb8e6beaab01e9c7eaf5cdc12a34987402fb9b72f (diff)
downloademacs-8c0f9be0d1ace6437d4c604b9af79b7b0006dec4.tar.gz
emacs-8c0f9be0d1ace6437d4c604b9af79b7b0006dec4.zip
Only allow SQLite extensions from an allowlist
* src/sqlite.c (Fsqlite_load_extension): Only allow extensions from an allowlist.
Diffstat (limited to 'test/src/sqlite-tests.el')
-rw-r--r--test/src/sqlite-tests.el32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el
index 6a88f0fd6ca..d1076e481c4 100644
--- a/test/src/sqlite-tests.el
+++ b/test/src/sqlite-tests.el
@@ -182,4 +182,36 @@
182 (sqlite-close db) 182 (sqlite-close db)
183 (should-error (sqlite-select db "select * from test6")))) 183 (should-error (sqlite-select db "select * from test6"))))
184 184
185(ert-deftest sqlite-load-extension ()
186 (skip-unless (sqlite-available-p))
187 (let (db)
188 (setq db (sqlite-open))
189 (should-error
190 (sqlite-load-extension db "/usr/lib/sqlite3/notpcre.so"))
191 (should-error
192 (sqlite-load-extension db "/usr/lib/sqlite3/n"))
193 (should-error
194 (sqlite-load-extension db "/usr/lib/sqlite3/"))
195 (should-error
196 (sqlite-load-extension db "/usr/lib/sqlite3"))
197 (should
198 (memq
199 (sqlite-load-extension db "/usr/lib/sqlite3/pcre.so")
200 '(nil t)))
201
202 (should-error
203 (sqlite-load-extension
204 db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_notcsvtable.so"))
205 (should-error
206 (sqlite-load-extension
207 db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtablen.so"))
208 (should-error
209 (sqlite-load-extension
210 db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtable"))
211 (should
212 (memq
213 (sqlite-load-extension
214 db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtable.so")
215 '(nil t)))))
216
185;;; sqlite-tests.el ends here 217;;; sqlite-tests.el ends here