My code is something like:
```
S2Polygon* convertOGRPolygonToS2Polygon(OGRPolygon& ogrPolygon) {
// Process exterior ring
...
// Create S2 instances
std::vector<std::unique_ptr<S2Loop>> loops; // This is the line where the error occurs.
loops.push_back(std::make_unique<S2Loop>(vertices));
loops.back()->Normalize();
// Process interior rings (holes)
...
}
```
And when the error occurs the stack trace is as follows:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000000e (pc 0x64b86f5fe562 bp 0x7ffc88b15210 sp 0x7ffc88b15200 T0)
==1==The signal is caused by a READ memory access.
==1==Hint: address points to the zero page.
#0 0x64b86f5fe562 in absl::lts_20240722::container_internal::btree_node<absl::lts_20240722::container_internal::map_params<S2CellId, S2ShapeIndexCell*, std::less<S2CellId>, std::allocator<std::pair<S2CellId const, S2ShapeIndexCell*> >, 256, false> >::finish() const ../third-party/install/include/absl/container/internal/btree.h:694
#1 0x64b86f5fafc0 in absl::lts_20240722::container_internal::btree<absl::lts_20240722::container_internal::map_params<S2CellId, S2ShapeIndexCell*, std::less<S2CellId>, std::allocator<std::pair<S2CellId const, S2ShapeIndexCell*> >, 256, false> >::end() const ../third-party/install/include/absl/container/internal/btree.h:1433
#2 0x64b870b7c60d in absl::lts_20240722::container_internal::btree_container<absl::lts_20240722::container_internal::btree<absl::lts_20240722::container_internal::map_params<S2CellId, S2ShapeIndexCell*, std::less<S2CellId>, std::allocator<std::pair<S2CellId const, S2ShapeIndexCell*> >, 256, false> > >::end() const (app+0x575460d)
#3 0x64b870b79800 in MutableS2ShapeIndex::Iterator::InitStale(MutableS2ShapeIndex const*, S2ShapeIndex::InitialPosition) (app+0x5751800)
#4 0x64b870b7027a in MutableS2ShapeIndex::Minimize() (app+0x574827a)
#5 0x64b870b709bc in MutableS2ShapeIndex::ReleaseAll() (app+0x57489bc)
#6 0x64b870b70a32 in MutableS2ShapeIndex::Clear() (app+0x5748a32)
#7 0x64b870bba6c8 in S2Loop::ClearIndex() (app+0x57926c8)
#8 0x64b870bba723 in S2Loop::Init(absl::lts_20240722::Span<S2Point const>) (app+0x5792723)
...
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../third-party/install/include/absl/container/internal/btree.h:694 in absl::lts_20240722::container_internal::btree_node<absl::lts_20240722::container_internal::map_params<S2CellId, S2ShapeIndexCell*, std::less<S2CellId>, std::allocator<std::pair<S2CellId const, S2ShapeIndexCell*> >, 256, false> >::finish() const
==1==ABORTING
```
If I compile the app without using those flags or if I use this macro:
```
#if defined(__clang__) || defined (__GNUC__)
# define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#else
# define ATTRIBUTE_NO_SANITIZE_ADDRESS
#endif
on the convertOGRPolygonToS2Polygon method, asan does not report the problem.
```
I'd rather use the workaround instead of compiling my app without asan and I'm sorry for the bad code formatting.