Skip to content

rasterio terminates with "uncaught exception of type std::length_error" when running open() on DatasetReader #3105

@scottstanie

Description

@scottstanie

Expected behavior and actual behavior.

I accidentally stumbled on this by passing an opened dataset to rasterio.open instead of the filename. I'm getting a crash of python with the message

libc++abi: terminating due to uncaught exception of type std::length_error: basic_string
Abort trap: 6

Steps to reproduce the problem.

tiny dummy file:
mean.tif.zip

import rasterio as rio

src = rio.open("mean.tif")
rio.open(src)

Environment Information

In [2]: rio.show_versions()
rasterio info:
  rasterio: 1.3.10
      GDAL: 3.8.5
      PROJ: 9.4.0
      GEOS: 3.12.1
 PROJ DATA: /Users/staniewi/miniconda3/envs/mapping-311/share/proj
 GDAL DATA: /Users/staniewi/miniconda3/envs/mapping-311/share/gdal

System:
    python: 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:37:07) [Clang 15.0.7 ]
executable: /Users/staniewi/miniconda3/envs/mapping-311/bin/python3.11
   machine: macOS-14.5-arm64-arm-64bit

Python deps:
    affine: 2.4.0
     attrs: 23.1.0
   certifi: 2024.06.02
     click: 8.1.7
     cligj: 0.7.2
    cython: 3.0.6
     numpy: 1.26.2
    snuggs: 1.4.7
click-plugins: None
setuptools: 68.2.2

Installation Method

installed via conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions