Repository: pytorch
Issue: Heap-buffer-overflow in `_fft_c2r`
Labels: module: crash,module: error checking,triaged,module: edge cases,topic: fuzzer

### 🐛 Describe the bug

Under specific inputs, `_fft_c2r` triggered a crash.
```python
import torch

self = torch.full((3, 1, 3, 1,), 0.372049, dtype=torch.cfloat)
dim = [2]
normalization = 2
last_dim_size = 536870912
torch._fft_c2r(self, dim, normalization, last_dim_size)
```
In 2.5.0a0+git32f585d pytorch, Output:
```
Segmentation fault (core dumped)
```
In colab 2.5.1+cu121 pytorch, Output:
```
RuntimeError: in_size == signal_size[i + 1] || in_size == (signal_size[i + 1] / 2) + 1 INTERNAL ASSERT FAILED at "../aten/src/ATen/native/mkl/SpectralOps.cpp":466, please report a bug to PyTorch.
```
and 2.5.0a0+git32f585d pytorch ASAN report:
```
=================================================================
==1372420==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60e0002ccb48 at pc 0x7f40e5180042 bp 0x7ffcbc4e4080 sp 0x7ffcbc4e4070
READ of size 4 at 0x60e0002ccb48 thread T0
    #0 0x7f40e5180041 in pocketfft::detail::general_c2r<float>(pocketfft::detail::cndarr<pocketfft::detail::cmplx<float> > const&, pocketfft::detail::ndarr<float>&, unsigned long, bool, float, unsigned long)::{lambda()#1}::operator()() const /mnt/pytorch-2.5.0/third_party/pocketfft/pocketfft_hdronly.h:3356
    #1 0x7f40e5189f84 in void pocketfft::detail::threading::thread_map<pocketfft::detail::general_c2r<float>(pocketfft::detail::cndarr<pocketfft::detail::cmplx<float> > const&, pocketfft::detail::ndarr<float>&, unsigned long, bool, float, unsigned long)::{lambda()#1}>(unsigned long, pocketfft::detail::general_c2r<float>(pocketfft::detail::cndarr<pocketfft::detail::cmplx<float> > const&, pocketfft::detail::ndarr<float>&, unsigned long, bool, float, unsigned long)::{lambda()#1}) /mnt/pytorch-2.5.0/third_party/pocketfft/pocketfft_hdronly.h:792
    #2 0x7f40e51807ad in void pocketfft::detail::general_c2r<float>(pocketfft::detail::cndarr<pocketfft::detail::cmplx<float> > const&, pocketfft::detail::ndarr<float>&, unsigned long, bool, float, unsigned long) /mnt/pytorch-2.5.0/third_party/pocketfft/pocketfft_hdronly.h:3302
    #3 0x7f40e517a7cb in void pocketfft::detail::c2r<float>(std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<long, std::allocator<long> > const&, std::vector<long, std::allocator<long> > const&, unsigned long, bool, std::complex<float> const*, float*, float, unsigned long) /mnt/pytorch-2.5.0/third_party/pocketfft/pocketfft_hdronly.h:3479
    #4 0x7f40e5177097 in void pocketfft::detail::c2r<float>(std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<long, std::allocator<long> > const&, std::vector<long, std::allocator<long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, bool, std::complex<float> const*, float*, float, unsigned long) /mnt/pytorch-2.5.0/third_party/pocketfft/pocketfft_hdronly.h:3489
    #5 0x7f40e5167588 in at::native::_fft_c2r_mkl(at::Tensor const&, c10::ArrayRef<long>, long, long) /mnt/pytorch-2.5.0/aten/src/ATen/native/mkl/SpectralOps.cpp:268
    #6 0x7f40e7b6a98a in wrapper_CPU___fft_c2r /mnt/pytorch-2.5.0/build/aten/src/ATen/RegisterCPU.cpp:6541
    #7 0x7f40e7fb6b2d in operator() /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13
    #8 0x7f40e7fb6b2d in call /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:468
    #9 0x7f40e799328c in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt>(void*, c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, c10::ArrayRef<long>&&, long&&, c10::SymInt&&) /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:53
    #10 0x7f40e781c0d0 in at::Tensor c10::KernelFunction::call<at::Tensor, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt>(c10::OperatorHandle const&, c10::DispatchKeySet, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) const /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:93
    #11 0x7f40e781c0d0 in at::Tensor c10::Dispatcher::redispatch<at::Tensor, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt>(c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt)> const&, c10::DispatchKeySet, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:714
    #12 0x7f40e7594a75 in c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt)>::redispatch(c10::DispatchKeySet, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:536
    #13 0x7f40e7594a75 in at::_ops::_fft_c2r::redispatch(c10::DispatchKeySet, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) /mnt/pytorch-2.5.0/build/aten/src/ATen/Operators_4.cpp:2749
    #14 0x7f40f06da110 in at::redispatch::_fft_c2r_symint(c10::DispatchKeySet, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) /mnt/pytorch-2.5.0/build/aten/src/ATen/RedispatchFunctions.h:3737
    #15 0x7f40f031cda2 in operator() /mnt/pytorch-2.5.0/torch/csrc/autograd/generated/VariableType_4.cpp:858
    #16 0x7f40f031d74d in _fft_c2r /mnt/pytorch-2.5.0/torch/csrc/autograd/generated/VariableType_4.cpp:859
    #17 0x7f40f0602a10 in operator() /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13
    #18 0x7f40f0602a10 in call /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:485
    #19 0x7f40e799328c in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt>(void*, c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, c10::ArrayRef<long>&&, long&&, c10::SymInt&&) /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:53
    #20 0x7f40e7593d68 in at::Tensor c10::KernelFunction::call<at::Tensor, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt>(c10::OperatorHandle const&, c10::DispatchKeySet, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) const /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:93
    #21 0x7f40e7593d68 in at::Tensor c10::Dispatcher::call<at::Tensor, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt>(c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt)> const&, at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:698
    #22 0x7f40e7593d68 in c10::TypedOperatorHandle<at::Tensor (at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt)>::call(at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:531
    #23 0x7f40e7593d68 in at::_ops::_fft_c2r::call(at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) /mnt/pytorch-2.5.0/build/aten/src/ATen/Operators_4.cpp:2742
    #24 0x7f412a9a1a71 in at::_fft_c2r_symint(at::Tensor const&, c10::ArrayRef<long>, long, c10::SymInt) /mnt/pytorch-2.5.0/build/aten/src/ATen/ops/_fft_c2r.h:38
    #25 0x7f412a8807b4 in operator() /mnt/pytorch-2.5.0/torch/csrc/autograd/generated/python_torch_functions_2.cpp:3969
    #26 0x7f412a881251 in THPVariable__fft_c2r /mnt/pytorch-2.5.0/torch/csrc/autograd/generated/python_torch_functions_2.cpp:3971
    #27 0x56abf2 in cfunction_call /usr/local/src/conda/python-3.13.0/Objects/methodobject.c:540
    #28 0x5341f3 in _PyObject_MakeTpCall /usr/local/src/conda/python-3.13.0/Objects/call.c:242
    #29 0x549ece in _PyEval_EvalFrameDefault /usr/local/src/conda/python-3.13.0/Python/generated_cases.c.h:813
    #30 0x60902d in PyEval_EvalCode /usr/local/src/conda/python-3.13.0/Python/ceval.c:596
    #31 0x62eedc in run_eval_code_obj /usr/local/src/conda/python-3.13.0/Python/pythonrun.c:1323
    #32 0x629d9c in run_mod /usr/local/src/conda/python-3.13.0/Python/pythonrun.c:1408
    #33 0x64888f in pyrun_file /usr/local/src/conda/python-3.13.0/Python/pythonrun.c:1241
    #34 0x6473fa in _PyRun_SimpleFileObject /usr/local/src/conda/python-3.13.0/Python/pythonrun.c:490
    #35 0x64711a in _PyRun_AnyFileObject /usr/local/src/conda/python-3.13.0/Python/pythonrun.c:77
    #36 0x640b66 in pymain_run_file_obj /usr/local/src/conda/python-3.13.0/Modules/main.c:409
    #37 0x640b66 in pymain_run_file /usr/local/src/conda/python-3.13.0/Modules/main.c:428
    #38 0x640b66 in pymain_run_python /usr/local/src/conda/python-3.13.0/Modules/main.c:696
    #39 0x640b66 in Py_RunMain /usr/local/src/conda/python-3.13.0/Modules/main.c:775
    #40 0x5f9508 in Py_BytesMain /usr/local/src/conda/python-3.13.0/Modules/main.c:829
    #41 0x7f41330a1d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
    #42 0x7f41330a1e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
    #43 0x5f885c  (/mnt/anaconda3/envs/pytorch-2.3-asan/bin/python3.13+0x5f885c)

0x60e0002ccb48 is located 0 bytes to the right of 72-byte region [0x60e0002ccb00,0x60e0002ccb48)
allocated by thread T0 here:
    #0 0x7f413345457c in __interceptor_posix_memalign ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:226
    #1 0x7f40d17601f1 in c10::alloc_cpu(unsigned long) /mnt/pytorch-2.5.0/c10/core/impl/alloc_cpu.cpp:116
    #2 0x7f40d1690068 in c10::DefaultCPUAllocator::allocate(unsigned long) (/mnt/pytorch-2.5.0/torch/lib/libc10.so+0x9d068)
    #3 0x7f40e267e966 in c10::StorageImpl::StorageImpl(c10::StorageImpl::use_byte_size_t, c10::SymInt const&, c10::Allocator*, bool) (/mnt/pytorch-2.5.0/torch/lib/libtorch_cpu.so+0x10cac966)
    #4 0x7f40e268c914 in c10::intrusive_ptr<c10::StorageImpl, c10::detail::intrusive_target_default_null_type<c10::StorageImpl> > c10::intrusive_ptr<c10::StorageImpl, c10::detail::intrusive_target_default_null_type<c10::StorageImpl> >::make<c10::StorageImpl::use_byte_size_t, unsigned long&, c10::Allocator*&, bool>(c10::StorageImpl::use_byte_size_t&&, unsigned long&, c10::Allocator*&, bool&&) (/mnt/pytorch-2.5.0/torch/lib/libtorch_cpu.so+0x10cba914)
    #5 0x7f40e268b61f in c10::intrusive_ptr<c10::StorageImpl, c10::detail::intrusive_target_default_null_type<c10::StorageImpl> > c10::make_intrusive<c10::StorageImpl, c10::detail::intrusive_target_default_null_type<c10::StorageImpl>, c10::StorageImpl::use_byte_size_t, unsigned long&, c10::Allocator*&, bool>(c10::StorageImpl::use_byte_size_t&&, unsigned long&, c10::Allocator*&, bool&&) (/mnt/pytorch-2.5.0/torch/lib/libtorch_cpu.so+0x10cb961f)
    #6 0x7f40e2688c91 in at::TensorBase at::detail::_empty_generic<long>(c10::ArrayRef<long>, c10::Allocator*, c10::DispatchKeySet, c10::ScalarType, std::optional<c10::MemoryFormat>) (/mnt/pytorch-2.5.0/torch/lib/libtorch_cpu.so+0x10cb6c91)
    #7 0x7f40e267952e in at::detail::empty_generic(c10::ArrayRef<long>, c10::Allocator*, c10::DispatchKeySet, c10::ScalarType, std::optional<c10::MemoryFormat>) /mnt/pytorch-2.5.0/aten/src/ATen/EmptyTensor.cpp:203
    #8 0x7f40e2679d21 in at::detail::empty_cpu(c10::ArrayRef<long>, c10::ScalarType, bool, std::optional<c10::MemoryFormat>) /mnt/pytorch-2.5.0/aten/src/ATen/EmptyTensor.cpp:260
    #9 0x7f40e267a04a in at::detail::empty_cpu(c10::ArrayRef<long>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) /mnt/pytorch-2.5.0/aten/src/ATen/EmptyTensor.cpp:275
    #10 0x7f40e4327aa0 in at::native::empty_cpu(c10::ArrayRef<long>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) /mnt/pytorch-2.5.0/aten/src/ATen/native/TensorFactories.cpp:249
    #11 0x7f40e7b57f61 in wrapper_CPU_memory_format_empty /mnt/pytorch-2.5.0/build/aten/src/ATen/RegisterCPU.cpp:5260
    #12 0x7f40e7fa8f05 in operator() /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13
    #13 0x7f40e7fa8f05 in call /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:468
    #14 0x7f40e6d79ca7 in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat> >(void*, c10::OperatorKernel*, c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>&&, std::optional<c10::ScalarType>&&, std::optional<c10::Layout>&&, std::optional<c10::Device>&&, std::optional<bool>&&, std::optional<c10::MemoryFormat>&&) /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:53
    #15 0x7f40e6aa507c in at::Tensor c10::KernelFunction::call<at::Tensor, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat> >(c10::OperatorHandle const&, c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) const /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:93
    #16 0x7f40e6aa507c in at::Tensor c10::Dispatcher::redispatch<at::Tensor, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat> >(c10::TypedOperatorHandle<at::Tensor (c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>)> const&, c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:714
    #17 0x7f40e6703c6a in c10::TypedOperatorHandle<at::Tensor (c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>)>::redispatch(c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:536
    #18 0x7f40e6703c6a in at::_ops::empty_memory_format::redispatch(c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) /mnt/pytorch-2.5.0/build/aten/src/ATen/Operators_2.cpp:3337
    #19 0x7f40e7a5ec48 in empty_memory_format /mnt/pytorch-2.5.0/build/aten/src/ATen/RegisterBackendSelect.cpp:185
    #20 0x7f40e7aab160 in operator() /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13
    #21 0x7f40e7aab160 in call /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:468
    #22 0x7f40e6d79ca7 in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat> >(void*, c10::OperatorKernel*, c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>&&, std::optional<c10::ScalarType>&&, std::optional<c10::Layout>&&, std::optional<c10::Device>&&, std::optional<bool>&&, std::optional<c10::MemoryFormat>&&) /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:53
    #23 0x7f40e6702623 in at::Tensor c10::KernelFunction::call<at::Tensor, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat> >(c10::OperatorHandle const&, c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) const /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:93
    #24 0x7f40e6702623 in at::Tensor c10::Dispatcher::call<at::Tensor, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat> >(c10::TypedOperatorHandle<at::Tensor (c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>)> const&, c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:698
    #25 0x7f40e6702623 in c10::TypedOperatorHandle<at::Tensor (c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>)>::call(c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:531
    #26 0x7f40e6702623 in at::_ops::empty_memory_format::call(c10::ArrayRef<c10::SymInt>, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>, std::optional<c10::MemoryFormat>) /mnt/pytorch-2.5.0/build/aten/src/ATen/Operators_2.cpp:3330
    #27 0x7f40e286a151 in at::empty(c10::ArrayRef<long>, c10::TensorOptions, std::optional<c10::MemoryFormat>) /mnt/pytorch-2.5.0/build/aten/src/ATen/ops/empty.h:36
    #28 0x7f40e43366c2 in at::native::full(c10::ArrayRef<long>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>) /mnt/pytorch-2.5.0/aten/src/ATen/native/TensorFactories.cpp:619
    #29 0x7f40e82c3c1f in wrapper_CompositeExplicitAutograd__full /mnt/pytorch-2.5.0/build/aten/src/ATen/RegisterCompositeExplicitAutograd.cpp:2400
    #30 0x7f40e864003c in operator() /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13
    #31 0x7f40e864003c in call /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:468
    #32 0x7f40e798e3d0 in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool> >(void*, c10::OperatorKernel*, c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>&&, c10::Scalar const&, std::optional<c10::ScalarType>&&, std::optional<c10::Layout>&&, std::optional<c10::Device>&&, std::optional<bool>&&) /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:53
    #33 0x7f40e781825e in at::Tensor c10::KernelFunction::call<at::Tensor, c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool> >(c10::OperatorHandle const&, c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>) const /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:93
    #34 0x7f40e781825e in at::Tensor c10::Dispatcher::redispatch<at::Tensor, c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool> >(c10::TypedOperatorHandle<at::Tensor (c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>)> const&, c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:714
    #35 0x7f40e7584056 in c10::TypedOperatorHandle<at::Tensor (c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>)>::redispatch(c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>) const /mnt/pytorch-2.5.0/aten/src/ATen/core/dispatch/Dispatcher.h:536
    #36 0x7f40e7584056 in at::_ops::full::redispatch(c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool>) /mnt/pytorch-2.5.0/build/aten/src/ATen/Operators_4.cpp:2549
    #37 0x7f40e7a608ca in full /mnt/pytorch-2.5.0/build/aten/src/ATen/RegisterBackendSelect.cpp:252
    #38 0x7f40e7ab230c in operator() /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h:13
    #39 0x7f40e7ab230c in call /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:468
    #40 0x7f40e798e3d0 in at::Tensor c10::callUnboxedKernelFunction<at::Tensor, c10::ArrayRef<c10::SymInt>, c10::Scalar const&, std::optional<c10::ScalarType>, std::optional<c10::Layout>, std::optional<c10::Device>, std::optional<bool> >(void*, c10::OperatorKernel*, c10::DispatchKeySet, c10::ArrayRef<c10::SymInt>&&, c10::Scalar const&, std::optional<c10::ScalarType>&&, std::optional<c10::Layout>&&, std::optional<c10::Device>&&, std::optional<bool>&&) /mnt/pytorch-2.5.0/aten/src/ATen/core/boxing/KernelFunction_impl.h:53

SUMMARY: AddressSanitizer: heap-buffer-overflow /mnt/pytorch-2.5.0/third_party/pocketfft/pocketfft_hdronly.h:3356 in pocketfft::detail::general_c2r<float>(pocketfft::detail::cndarr<pocketfft::detail::cmplx<float> > const&, pocketfft::detail::ndarr<float>&, unsigned long, bool, float, unsigned long)::{lambda()#1}::operator()() const
Shadow bytes around the buggy address:
  0x0c1c80051910: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c1c80051920: fd fd fd fd fa fa fa fa fa fa fa fa fd fd fd fd
  0x0c1c80051930: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c1c80051940: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c1c80051950: fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa
=>0x0c1c80051960: 00 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa
  0x0c1c80051970: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c80051980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c80051990: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c800519a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c800519b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==1372420==ABORTING
```

### Versions

[pip3] numpy==2.1.3
[pip3] torch==2.5.0a0+git32f585d
[conda] numpy 2.1.3 pypi_0 pypi
[conda] torch 2.5.0a0+git32f585d pypi_0 pyp

cc @malfet