Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-re
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nils Goroll
libvmod-re
Commits
b4497cfd
Commit
b4497cfd
authored
May 16, 2017
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an off-by-one error checking the allocation of subject in task data.
Fixes #3 for 5.1.
parent
2c142833
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
c01.vtc
src/tests/c01.vtc
+34
-0
vmod_re.c
src/vmod_re.c
+1
-1
No files found.
src/tests/c01.vtc
View file @
b4497cfd
...
@@ -143,3 +143,37 @@ client c1 {
...
@@ -143,3 +143,37 @@ client c1 {
expect resp.http.frap == "_barf_frap_"
expect resp.http.frap == "_barf_frap_"
expect resp.http.frapd == "_barf_frap_"
expect resp.http.frapd == "_barf_frap_"
} -run
} -run
# Test copying the subject into private task-scoped data
varnish v1 -vcl {
import re from "${vmod_topbuild}/src/.libs/libvmod_re.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bar = re.regex("bar");
}
sub vcl_recv {
return(synth(200));
}
sub vcl_synth {
if (bar.match("bar45678")) {
set resp.http.bar8 = bar.backref(0);
}
if (bar.match("bar456789")) {
set resp.http.bar9 = bar.backref(0);
}
if (bar.match("bar4567")) {
set resp.http.bar7 = bar.backref(0);
}
}
}
client c1 {
txreq
rxresp
expect resp.http.bar7 == "bar"
expect resp.http.bar8 == "bar"
expect resp.http.bar9 == "bar"
} -run
src/vmod_re.c
View file @
b4497cfd
...
@@ -217,7 +217,7 @@ backref(VRT_CTX, VCL_INT refnum, VCL_STRING fallback, struct vmod_priv *task)
...
@@ -217,7 +217,7 @@ backref(VRT_CTX, VCL_INT refnum, VCL_STRING fallback, struct vmod_priv *task)
WS_Assert_Allocated
(
ctx
->
ws
,
task
->
priv
,
sizeof
(
*
ov
)
-
1
);
WS_Assert_Allocated
(
ctx
->
ws
,
task
->
priv
,
sizeof
(
*
ov
)
-
1
);
CAST_OBJ
(
ov
,
task
->
priv
,
OV_MAGIC
);
CAST_OBJ
(
ov
,
task
->
priv
,
OV_MAGIC
);
WS_Assert_Allocated
(
ctx
->
ws
,
ov
->
subject
,
-
1
);
WS_Assert_Allocated
(
ctx
->
ws
,
ov
->
subject
,
strlen
(
ov
->
subject
)
-
1
);
refnum
<<=
1
;
refnum
<<=
1
;
assert
(
refnum
+
1
<
MAX_OV_USED
);
assert
(
refnum
+
1
<
MAX_OV_USED
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment