Skip to content

Fix overwriting buffer#23

Open
terence1990 wants to merge 1 commit intodiegomura:mainfrom
terence1990:patch-1
Open

Fix overwriting buffer#23
terence1990 wants to merge 1 commit intodiegomura:mainfrom
terence1990:patch-1

Conversation

@terence1990
Copy link

@terence1990 terence1990 commented Feb 10, 2025

@diegomura

.slice() is an in-place js function, it overwrites the buffer.

To test decode same buffer twice:

jay.decode(file);
jay.decode(file);

Current output:

{
  entries: {
    orientation: 6,
    xResolution: [ 72 ],
    yResolution: [ 72 ],
    resolutionUnit: 2,
    ycbCrPositioning: 1,
    exifIFDPointer: 102
  }
}
{
  entries: {
    exifVersion: null,
    componentsConfiguration: null,
    flashpixVersion: null,
    colorSpace: 65535,
    pixelXDimension: 801,
    pixelYDimension: 601
  }
}
{ entries: { undefined: 102 } }

Output after fix:

{
  entries: {
    orientation: 6,
    xResolution: [ 72 ],
    yResolution: [ 72 ],
    resolutionUnit: 2,
    ycbCrPositioning: 1,
    exifIFDPointer: 102
  }
}
{
  entries: {
    exifVersion: null,
    componentsConfiguration: null,
    flashpixVersion: null,
    colorSpace: 65535,
    pixelXDimension: 801,
    pixelYDimension: 601
  }
}
{
  entries: {
    orientation: 6,
    xResolution: [ 72 ],
    yResolution: [ 72 ],
    resolutionUnit: 2,
    ycbCrPositioning: 1,
    exifIFDPointer: 102
  }
}
{
  entries: {
    exifVersion: null,
    componentsConfiguration: null,
    flashpixVersion: null,
    colorSpace: 65535,
    pixelXDimension: 801,
    pixelYDimension: 601
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments