Skip to content

[Bug]: Infinite loop when there is single double quote in matplotlibrc #22636

Closed
@yy0931

Description

@yy0931

Bug summary

This code https://github.com/timhoffm/matplotlib/blob/7c378a8f3f30ce57c874a851f3af8af58f1ffdf6/lib/matplotlib/cbook/__init__.py#L403-L415 on the main branch (not released yet) falls into an infinite loop when there is only one double quotation because when s.find('"', quote_pos + 1) == -1 pos == 0

context:

Code for reproduction

from pathlib import Path

import matplotlib.pyplot as plt

Path("./test.mplstyle").write_text('grid.color: "aa')
plt.style.use("./test.mplstyle")

Actual outcome

The program doesn't exit.

Expected outcome

Show an error or set '"aa'.

Additional information

No response

Operating system

No response

Matplotlib Version

3.6.0.dev1816+gb9ae51ca8c.d20220311

Matplotlib Backend

No response

Python version

Python 3.10.0

Jupyter version

No response

Installation

No response

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions