GithubHelp home page GithubHelp logo

Comments (1)

sayurin avatar sayurin commented on June 2, 2024

OSS化当初からヒストリ個数 0 を想定していないコードになっていました。

ffftp/history.c

Lines 103 to 120 in 2bf85c0

void AddHistoryToHistory(HISTORYDATA *Hist)
{
HISTORYDATA *New;
CheckHistoryNum(1);
if(FileHist > HistoryNum)
{
New = malloc(sizeof(HISTORYDATA));
if(New != NULL)
{
memcpy(New, Hist, sizeof(HISTORYDATA));
New->Next = HistoryBase;
HistoryBase = New;
HistoryNum++;
}
}
return;
}

ヒストリを追加する前にCheckHistoryNum(1)でスペースを1個分空けます。

ffftp/history.c

Lines 147 to 180 in 2bf85c0

void CheckHistoryNum(int Space)
{
int i;
HISTORYDATA *Prev;
HISTORYDATA *Pos;
HISTORYDATA *Next;
if(HistoryNum > FileHist-Space)
{
/* 残すべきヒストリを探す */
Pos = HistoryBase;
Prev = NULL;
for(i = 0; i < FileHist-Space; i++)
{
Prev = Pos;
Pos = Pos->Next;
}
/* いらないヒストリを消す */
if(Prev == NULL)
HistoryBase = NULL;
else
Prev->Next = NULL;
while(Pos != NULL)
{
Next = Pos->Next;
free(Pos);
Pos = Next;
HistoryNum--;
}
}
return;
}

内部では FileHist-Space とやっていてunderflowを引き起こしていました。


v4.4 で行った #157 リファクタリング後の現在の実装でも

ffftp/history.cpp

Lines 48 to 52 in f2de70b

void AddHistoryToHistory(HISTORYDATA const& history) {
if (size_as<int>(histories) == FileHist)
histories.resize((size_t)FileHist - 1);
histories.insert(begin(histories), history);
}

スペースを1個分空ける際にunderflowを引き起こしていました。これが原因で起動できなくなっているようです。

from ffftp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.