Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bytearray().__buffer__(256) crashes #126980

Closed
Assignees
sobolevn
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump
@sobolevn

Description

@sobolevn

Crash report

Code says that it cannot fail:

staticint
bytearray_getbuffer(PyObject*self,Py_buffer*view,intflags)
{
PyByteArrayObject*obj=_PyByteArray_CAST(self);
if (view==NULL) {
PyErr_SetString(PyExc_BufferError,
"bytearray_getbuffer: view==NULL argument is obsolete");
return-1;
}
void*ptr= (void*)PyByteArray_AS_STRING(obj);
/* cannot fail if view != NULL and readonly == 0 */
(void)PyBuffer_FillInfo(view, (PyObject*)obj,ptr,Py_SIZE(obj),0,flags);

But, it can:

if (flags!=PyBUF_SIMPLE) {/* fast path */
if (flags==PyBUF_READ||flags==PyBUF_WRITE) {
PyErr_BadInternalCall();
return-1;
}

I have a PR ready.

CC@JelleZijlstra

Linked PRs

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp