CCExtractor / CCExtractor/ccextractor

Replace static buffer with dynamic allocation in writercwtdata()

未关闭
#2,091 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C
星标
903
派生
589
平均合并
3 天 2 小时
30 天内合并 PR
10

描述

## Description
The `writercwtdata()` function in `src/lib_ccx/output.c` currently uses a static array for the `cbbuffer` variable. There's a TODO comment requesting to replace this with dynamic memory allocation using `malloc`.

**File:** `src/lib_ccx/output.c`
**Line:** ~156
**Function:** `writercwtdata()`

## Current Implementation
```c
static unsigned char cbbuffer[0xFFFF * 3]; // TODO: use malloc
```

## Proposed Change
Replace the static array with dynamically allocated memory to:
- Improve memory efficiency
- Follow modern C best practices
- Only allocate memory when the function is actually used

## Benefits
1. Memory is only allocated when needed
2. Better resource management
3. Maintains backward compatibility
4. No change to external behavior

## Implementation Plan
I'm working on a PR that will:
1. Convert `cbbuffer` from static array to dynamically allocated pointer
2. Allocate memory on first use of the function
3. Add proper error handling for allocation failures
4. Add debug logging for buffer allocation

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。