]> git.kaiwu.me - njs.git/commit
Fixed external values initialization in unit tests.
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 9 Jan 2024 00:40:42 +0000 (16:40 -0800)
committerDmitry Volyntsev <xeioex@nginx.com>
Tue, 9 Jan 2024 00:40:42 +0000 (16:40 -0800)
commit7dcca79a30b750e9531cb76ed80a8890ab2695dd
tree1d88e634a9e8cae3d527c790c0a67dbe47b5b882
parente8a349f5fd7cf1b8a8c73f85c65d572190788675
Fixed external values initialization in unit tests.

Since 0.8.0 modules can create their own constructors and prototypes.
A modules has two method: preinit() and init(). A module should
add its constructors and prototypes in preinit() and create its own
values in init(). Creating a value in preinit() results in an error.
The patch fixes the issue by creating an external value in init()
instead of preinit().

Found by UndefinedBehaviorSanitizer.
src/test/njs_externals_test.c