include_if_exists=/path/to/asan/options reads flags from the file if it is present.
"%b" in the include file path (for both variants of the flag) is replaced with the basename of the main executable.
Add a comment that out should be at least kMaxPathLength. Also, you don't seem to actually trim s to this. constant if necessary. Consider using InternalScopedString *out and out->append() instead.
if base was trimmed, you would advance pointer t too far, and may make an out-of-bound write on the next iteration.