Skip to content

Commit

Permalink
Fix bug in understanding regex_search & regex_match parameter writes (#…
Browse files Browse the repository at this point in the history
…1186)

There was an oslc bug a long time ago (prior to OSL 1.10) in which the
3-argument versions of regex_search and regex_match failed to mark
their 'results' parameter as write-only in the oso.

In addition to fixing the bug in oslc so that subsequently-produced
oso files are correct, in order to properly interpret these
historically-compiled oso's, we also look for this particular case
upon reading the oso, in loadshader.cpp, and mark it correctly. This
was PR #922.

Except...

1) We neglected to distinguish the 2-arg version from the 3-arg version,
only the latter of which should be so marked.

2) We tested for regex_search twice (!) instead of testing for
regex_search and also regex_match.

Apologies! Here is the fix.

Thanks to Alex Wells for identifying the problem.

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz committed Jun 2, 2020
1 parent 5ddc2d0 commit 404db11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/liboslexec/loadshader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ OSOReaderToMaster::hint (string_view hintstring)
// This was a bug prior to 1.10.
static ustring regex_search("regex_search");
static ustring regex_match("regex_match");
if (opname == regex_search || opname == regex_search)
if ((opname == regex_search || opname == regex_match) && m_nargs > 3)
m_master->m_ops.back().argwriteonly (2);
return;
}
Expand Down

0 comments on commit 404db11

Please sign in to comment.